How do I get the current Undo and Redo item in ArcMap Operation Stack?

I just posted this on ESRI forum and found this link so I am trying it here too: Research ArcGIS Resource Center document - How to work with the operation stack: http://help.arcgis.com/en/sdk/10.0/a...00000288000000 I found out the following: "The Undo and Redo methods do not remove operations from the operation stack, but rather move an internal pointer up and down the stack." Question: So how do I get access to the operation that ArcMap is getting ready to Undo or Redo? History and sample code: I have been working on trying to manage ArcMap operation stack from a custom form. In the custom form we are actively editing data using ArcMap controls (add a sketch, modify feature, etc..) and we are also calling custom edits which are enclosed within StartOperation and StopOperation("EditOperationName"). In my code, I would like to evaluate the actual operation that ArcMap is getting ready to Undo or Redo and then perform a specified action if the Operation is a specified custom edit operation that was added within the edit session. I am able to return the name of all the menu string edit operations in the IOperationStack, I am able to call the mxDoc.OperationStack.Undo and Redo methods but I have not found a way to evaluate the actual Undo or Redo operation that ArcMap is pointing to. Refer to the code sample below for the Undo button click:               Private Sub btnUndoLastTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUndoLast.Click     'Dim pOperationStack As IOperationStack     'pOperationStack = _mxDocument.OperationStack          If _mxDocument.OperationStack.Count > 0 Then     Debug.Print("Before Undo is Selected")     For i = 0 To _mxDocument.OperationStack.Count - 1     Dim pOper As IOperation = _mxDocument.OperationStack.Item(i)     Debug.Print("operation number: " + i.ToString() + " Name: " + pOper.MenuString)          If pOper.CanUndo Then     Debug.Print("CanUndo Operation")     Else     Debug.Print("Can NOT Undo Operation")     End If     If pOper.CanRedo Then     Debug.Print("CanRedo Operation")     Else     Debug.Print("Can NOT Redo Operation")     End If     Next          '_editor.UndoOperation()     Dim pOperation As IOperation = _mxDocument.OperationStack.Item(_mxDocument.Operat ionStack.Count - 1)     Debug.Print("Operation Name = " + pOperation.MenuString.ToString())          If pOperation.MenuString = "Apply Rules" Then     'reset the IsApplyRules variable     _geoeditWorflow.IsApplyRulesSet = False     End If          pOperation = Nothing          _mxDocument.OperationStack.Undo()          Debug.Print("After Undo is Selected")     For i = 0 To _mxDocument.OperationStack.Count - 1     Dim pOper As IOperation = _mxDocument.OperationStack.Item(i)     Debug.Print("operation number: " + i.ToString() + " Name: " + pOper.MenuString)          If pOper.CanUndo Then     Debug.Print("CanUndo Operation")     Else     Debug.Print("Can NOT Undo Operation")     End If     If pOper.CanRedo Then     Debug.Print("CanRedo Operation")     Else     Debug.Print("Can NOT Redo Operation")     End If     Next     End If     End Sub      NOTE: 1) It is interesting to see that ArcMap acutually sets ALL Operations in its stack to either true or false for CanUndo or CanRedo properties regardless of wether this was the last operation that you applied undo or redo. 2) ArcMap keeps an Internal pointer to the stack and moves this pointer up and down. So, this means that the OperationStack is NOT reorganized (or even a true STACK.POP) based on an Undo and Redo. Therefore it doesn't appear like there is an easy way to get the operation Item that ArcMap is getting ready to undo or redo. You can see in ArcMap tools what the undo or redo operation name is by either hovering over the undo and redo buttons or in the standard Menu toolbar --> Edit -> Undo "Name" or Redo "Name" Any Ideas on how I can get the name of the NEXT Undo or Redo operation? I am trying to avoid having to write my own UndoStack and RedoStack if at all possible. Thanks for any help you can provide.


Upload Shape File using GeoServer REST API and C#

I'd like to upload shape files using GeoServer REST API and C#. So far, I can create workspaces using the REST API and C#. From GeoServer documentation (specific to cURL), the difference between creating a workspace and uploading a shape file is in the HTTP Method (workspace creation uses `POST`, shape file uploading uses `PUT`), ContentType (workspace creation uses `application/xml`, shape file uploading uses `application/zip`), and finally there is the `--data-binary` parameter in shape file uploading. The code I use for creating workspace is shown below. Can anyone kindly help me refactor this code so that I can use it to upload a shape file. Thanks in advance.                       String gUrl = "http://localhost:8081/geoserver/rest/workspaces";             WebRequest request = WebRequest.Create(gUrl);                  request.ContentType = "text/xml";             request.Method = "POST";             request.Credentials = new NetworkCredential("geoServer-username", "password");                  byte[] buffer = Encoding.GetEncoding("UTF-8").GetBytes("<workspace><name>new_workspace_csharp_2</name></workspace>");             Stream requestStream = request.GetRequestStream();             requestStream.Write(buffer, 0, buffer.Length);             requestStream.Close();                  WebResponse response = request.GetResponse();             Console.Write("Response from GeoServer: " + response);      EDITED: I've managed to make some headway, and I can now upload a shape file using C# and the GeoServer REST API. My refactoring effort, which now works, is shown below:                   public bool UploadShapeFile(string workspace, string dsName, Uri zipUri)         {             String fileUri = zipUri.AbsolutePath;             Console.Write(fileUri);                  byte[] localShapeFile = readLocalShapeFile(fileUri);                  String sUrl = "http://localhost:8081/geoserver/rest/workspaces/cs_ws1/datastores/cs_ds1/file.shp";             WebRequest request = WebRequest.Create(sUrl);                  request.ContentType = "application/zip";             request.Method = "PUT";             request.Credentials = new NetworkCredential("gs-username", "password");                  // byte[] buffer = Encoding.GetEncoding("UTF-8").GetBytes(@fileUri);             Stream requestStream = request.GetRequestStream();             requestStream.Write(localShapeFile, 0, localShapeFile.Length);             requestStream.Close();                  WebResponse response = request.GetResponse();             Console.Write("Response from GeoServer: " + response);                       return false;         }              private byte[] readLocalShapeFile(string filePath)         {             byte[] buffer;             FileStream fStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);             try {                 int length = (int)fStream.Length;                 buffer = new byte[length];                  int count;                  int sum = 0;                       // Read until Read method returns 0 - End of stream reached                 while ((count = fStream.Read(buffer, sum, length - sum)) > 0)                     sum += count;             }             finally {                 fStream.Close();             }                  return buffer;         }      However, I still believe there can be a more elegant way of doing this. Any suggestions will be highly appreciated.


Problem displaying OpenLayers KML layer in IE

I am serving the following files from a the same directory on localhost:               map.html     OpenLayers.js     output.kml      _map.html_ simply creates an OpenLayers map and displays the KML file as per the OpenLayers example. I access it via _http://localhost:8080/map.html_ and it all works fine in Firefox and Chrome but not in IE. In IE I get the navigation buttons but no map. The OpenLayers example does work in IE... The contents of _map.html_ are shown below:                         <title>Map</title>

                     Any ideas?


GeoServer container need to test locally?

GeoServer container need to test locally I did some tests with geoserver and openlayers but it did not work with the layers I have on my machine. I did not need the container to use locally calling my WMS layers using openlayers. My javascript pages are in the openlayers folder on my C :/ are not in JSF project. My question is I need the container to use locally in my tests?                   <!DOCTYPE html>     <html lang='en'>     <head>      <meta charset='utf-8' />      <title>My OpenLayers Map</title>      <script type='text/javascript' src='OpenLayers.js'></script>           <script src="http://maps.google.com/maps/api/js?sensor=false&v=3.2"></script>           <script type='text/javascript'>                var map;      var mercatorProjection = new OpenLayers.Projection('EPSG:900913');      var latLongProjection = new OpenLayers.Projection('EPSG:4326');      var bounds = new OpenLayers.Bounds(                     -51.2809219360352, -30.2445888519287,                     -51.0207977294922, -29.9661273956299                 );           function init() {            map = new OpenLayers.Map('map_element',{         maxExtent: bounds,         maxResolution:  0.0010877400636672,         units: 'm',         //allOverlays: true,         projection: mercatorProjection,         displayProjection: latLongProjection      });                var google_streets = new OpenLayers.Layer.Google(         "Ruas",         {numZoomLevels: 20}         );          var wms_layer = new OpenLayers.Layer.WMS(     'Linhas Ônibus',     'http://localhost:8080/geoserver/Teste/wms',     {layers: 'Teste:onibus', transparent: true},     {isBaseLayer: false,         opacity: 0.7}     );               //Adiciona as camadas ao mapa     map.addLayers([google_streets, wms_layer]);               var point = new OpenLayers.LonLat(-51.22,-30.08);      point.transform(new OpenLayers.Projection("EPSG:4326"),          map.getProjectionObject());      map.setCenter(point, 10);       //Camada de controle que vai mostrar as camadas no mapa      map.addControl(new OpenLayers.Control.LayerSwitcher({}));           //Verifica se o mapa tem um ponto central e o extende a sua extensão máxima      if(!map.getCenter()){      map.zoomToMaxExtent();           }      }           </script>     </head>          <body onload='init();'> <!-- Chama a função js init() -->           <!--Elemento HTML onde o mapa é exibido -->      <div id='map_element' style='width: 800px; height: 800px;'>      </div>          </body>     </html>


OpenLayers PanZoomBar css style

I need to use PanZoomBar in my application.               var panZoomBar = new OpenLayers.Control.PanZoomBar();     map.addControl(panZoomBar);      Also I need to overwrite the PanZoomBar css style. I overwrite the whole bar.               .olControlPanZoomBar {         top: 38px !important;         left: 18px !important;         width: 44px;         height: 214px;         background: transparent url(../images/zoombar_bg.png) no-repeat 50% 100%;     }      But how I can get access and overwrite the default buttons? I mean:               .whatName(Id)ShowIWriteHere {         some style     }


Check validity of file geodatabase using arcpy

AS the title suggests, how can I whether a GDB file is valid using arcpy? One approach is, only checking the whether the name ends with `.gdb`, but that's not a robust approach. Because a normal file can be ended with `.gdb`, where GDBs are essentially folders to OS. So how can I do that?


Extract information of a raster overlayed on another raster with a lower resolution directly in python

I have two aligned rasters with the same extent, one has a resolution of 5 meters and the other of 125 meters. I would like to place the 5 meter one over the 125 meter one and assign to these smaller pixels the value of the large pixel on which they land on. How can I do this in pure python code? The raster I/O is not a problem.


Is there mathmatical function/equation available for ArcGIS Network Analyst's Closest Facility Method?

I would like to use this function in other statistical programming, ideally SAS where td = (whatever the function is to calculate total distance from centroid of county to facility). The goal is to leverage other demographic weights in drive time and distance.


How does ESRI ArcGIS 10 recognize a WMS CRS?

I'm working on a WMS service with Mars data. Currently the GetCapabilities shows `<SRS>EPSG:4326</SRS>`. I assume ESRI ArcGIS 10 reads this and therefore the WMS has GCS_WGS_1984 as a Geographic Coordinate System? I would like to use a custom URL definition because I am working with data from Mars. Is it for example possible to add a URL with GML such as http://spatialreference.org/ref/iau2000/49900/gml/ ? Thanks in advance, Jelmer Oosthoek


Using gdal to convert from UTM to equidistant lat/lon

I am getting rather confused with converting a UTM gridded dataset into a equidistant/rectangular latlon gridded dataset. Can anybody help me? I have a UTM set with the following projection:               PROJCS["WGS 84 / UTM zone 18N",     GEOGCS["WGS 84",         DATUM["WGS_1984",             SPHEROID["WGS 84",6378137,298.257223563,                 AUTHORITY["EPSG","7030"]],             AUTHORITY["EPSG","6326"]],         PRIMEM["Greenwich",0],         UNIT["degree",0.0174532925199433],         AUTHORITY["EPSG","4326"]],     PROJECTION["Transverse_Mercator"],     PARAMETER["latitude_of_origin",0],     PARAMETER["central_meridian",-75],     PARAMETER["scale_factor",0.9996],     PARAMETER["false_easting",500000],     PARAMETER["false_northing",0],     UNIT["metre",1,         AUTHORITY["EPSG","9001"]],     AUTHORITY["EPSG","32618"]]     Origin = (556950.000000000000000,5573990.000000000000000)     Pixel Size = (90.000000000000000,-90.000000000000000)     Metadata:      AREA_OR_POINT=Area     Image Structure Metadata:      INTERLEAVE=BAND     Corner Coordinates:     Upper Left  (  556950.000, 5573990.000) ( 74d12' 0.38"W, 50d18'54.95"N)     Lower Left  (  556950.000, 4905470.000) ( 74d17' 9.82"W, 44d18' 0.91"N)     Upper Right (  655950.000, 5573990.000) ( 72d48'37.20"W, 50d17'50.61"N)     Lower Right (  655950.000, 4905470.000) ( 73d 2'43.67"W, 44d17' 8.74"N)     Center      (  606450.000, 5239730.000) ( 73d35'30.62"W, 47d18' 8.60"N)     Band 1 Block=1100x1 Type=Float32, ColorInterp=Gray      And want to convert this to a rectangular latlon set (with corners just as they are provided in the corner coordinates. What to do? I am sure it should be easy...The biggest problem is that if I directly convert this into latlon, it won't be equidistant... Cheers, help is appreciated.


Looking for best practice to connect multiple road vector line layers for routing (pgRouting) purposes

**The Data I have:**   * `Bridges` (line layer)   * `Municipal_roads` (line layer and does not include information in `Bridges`)   * `State_roads` (line layer that doesn't include `Municipal_roads` or `Bridges`) **Question:** Since these layers are continuously getting updated/upgraded especially in construction season; what is the _'best of practice'_ way to connect these layers to produce one layer for routing purposes? **Edit:** I would like to, if possible avoid merging the layers.


Delete identical by size?

I got a Feature class with some identicial fields! Now i only need one polygon which had the same ID and this is the one with the largest size? Is there a posibility to delete the Polygons which are identical by size so that only the largest Polygons(from the ones with the same ID) are left? For example:               ID   shape area          1    5     2    4     2    3     3    11     4    7     5    8     5    10      and i Need only the Polygons with the largest size that means the frist, second, fourth, fifth and the last!


How to interpolate GPS data correctly?

I'm working on a project that involves using linear interpolation to fit lines to lat/lng points. I'm pretty new at scientific programming related stuff, and I was wondering if people could steer me in the right direction.What is a good tutorial for linear interpolation in Python, preferably using GIS data?


Search cursor stops selecting after two iterations

I have a script which selects an extent from a grid and exports the data frame.               import os, arcpy          mxd = arcpy.mapping.MapDocument('CURRENT')     df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]     grid_lyr = arcpy.mapping.ListLayers(mxd,"grid")[0]     scur = arcpy.SearchCursor(grid_lyr)          for row in scur:         sqlExp = """{0} = '{1}'""".format(arcpy.AddFieldDelimiters(grid_lyr,"PageName"),row.getValue("PageName"))         arcpy.SelectLayerByAttribute_management(grid_lyr,"NEW_SELECTION",sqlExp)         print "Selecting {}".format(row.getValue("PageName"))         df.extent = grid_lyr.getSelectedExtent(False)         df.zoomToSelectedFeatures()         df.scale = df.scale*1.05         arcpy.mapping.ExportToTIFF(mxd,os.path.join(r'C:\temp\109147',row.getValue("PageName")+".tif"),df,817, 534,world_file=True)              arcpy.RefreshActiveView()     del scur, mxd      I ran this script last week, and it crashed ArcMap after exporting the first tiff. I then ran it in a blank ArcMap document, changed `CURRENT` to the full path and it worked (all 414 tiff files exported). I am running the same script again today, on the same data, from a blank document. It now successfully exports the first two tiffs, and then stops executing as if it is finished, without any errors. When I try to run it again, ArcMap crashes again. I am not sure what the problem is, last week when it failed I just opened a blank document, as that normally solves the issues half the time. I updated the code to include print statements for debugging:               for row in scur:         print "Row count: " +str(arcpy.GetCount_management(grid_lyr))         sqlExp = """{0} = '{1}'""".format(arcpy.AddFieldDelimiters(grid_lyr,"PageName"),row.getValue("PageName"))         arcpy.SelectLayerByAttribute_management(grid_lyr,"NEW_SELECTION",sqlExp)         print "SQL is: {}".format(sqlExp)         df.extent = grid_lyr.getSelectedExtent(False)         df.zoomToSelectedFeatures()         df.scale = df.scale*1.05         print "Data frame {0} has a scale of {1}".format(df.name, df.scale)         name = os.path.join(r'C:\temp\109147',row.getValue("PageName")+".tif")         arcpy.mapping.ExportToTIFF(mxd,name,df,817, 534,world_file=True)         print "Exported {}".format(name)          arcpy.RefreshActiveView()          del scur, mxd, row      The output was:               Row count: 500     SQL is: "PageName" = 'E3'     Data frame Layers has a scale of 2276.80888604     Exported C:\temp\109147\E3.tif     Row count: 1     SQL is: "PageName" = 'E4'     Data frame Layers has a scale of 2276.80888604     Exported C:\temp\109147\E4.tif      My grid layer only has 414 features, so the row count numbers are a bit weird. Also, if I try to define the cursor variable again in the same session, ArcMap crashes.


how to generate a NDVI in QGIS

i have tried using raster calculator to generate NDVI and tried searching for but couldn't find it. is there any other way to extract NDVI and what are the procedures to generate NDVI in QGIS.


Crop and reproject shapefile based on GeoTIFF sample

I have GeoTIFF with these attributes:               Size is 495, 309     Coordinate System is:     PROJCS["unnamed",         GEOGCS["unnamed ellipse",             DATUM["unknown",                 SPHEROID["unnamed",6370000,0]],             PRIMEM["Greenwich",0],             UNIT["degree",0.0174532925199433]],         PROJECTION["Lambert_Conformal_Conic_1SP"],         PARAMETER["latitude_of_origin",47.5],         PARAMETER["central_meridian",4],         PARAMETER["scale_factor",1],         PARAMETER["false_easting",0],         PARAMETER["false_northing",0],         UNIT["metre",1,             AUTHORITY["EPSG","9001"]]]     PROJ.4 string is:     '+proj=lcc +lat_1=47.5 +lat_0=47.5 +lon_0=4 +k_0=1 +x_0=0 +y_0=0 +a=6370000 +b=6370000 +units=m +no_defs '     Origin = (-2963997.870569999800000,-1848004.200800000000000)     Pixel Size = (11975.754948303031000,11961.191901488673000)     Image Structure Metadata:       COMPRESSION=LZW       INTERLEAVE=BAND     Corner Coordinates:     Upper Left  (-2963997.871,-1848004.201) ( 24d36'23.04"W, 26d22' 5.88"N)     Lower Left  (-2963997.871, 1848004.097) ( 45d39'38.75"W, 55d16'35.82"N)     Upper Right ( 2964000.829,-1848004.201) ( 32d36'23.13"E, 26d22' 5.85"N)     Lower Right ( 2964000.829, 1848004.097) ( 53d39'38.88"E, 55d16'35.76"N)     Center      (   1.4791350,  -0.0520200) (  4d 0' 0.07"E, 47d30' 0.00"N)     Band 1 Block=495x4 Type=Float32, ColorInterp=Gray       NoData Value=9.969209968386869e+036      and I want to overlay Natural Earth shapefile. So I have to crop and reproject global Natural Earth shapefile to this GeoTIFF sample, however I can't understand how to do this with such projection and was wondering if I can instruct somehow `ogr2ogr` to use my GeoTIFF as reference to crop and reproject the shapefile? Also I'm interested in other approaches if `ogr2ogr` does not have this feature.


Leaflet HTTP.Get bad request; not loading tiles

I am trying to walk through the Leaflet quick start tutorial and am having a really simple issue: None of my tiles are loading. I get this error at the image url and an HTTP Bad Request in the inspector: > {"message":"id must be a string with the format account.handle"} My code is the same as the tutorial:               <link rel="stylesheet" href="//cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />


Deleting unconnected lines with QGIS

I am using a road map in shapefile format in order to calculate a route between two points. The map is downloaded from OpenStreetMap and it has small unconnected lines that are messing up my routing. Is there any way that I could get rid of those without having to manually remove them one by one? The lines look like this: http://screencast.com/t/4jnQFx57


Optimum grid/pixel size for interpolating rainfall and temperature

I have a set monthly rainfall and temperature data within an approximately 100 x 100 km study area. The sampling points are unevenly distributed within the study area. Based on a paper by Janis et. al, the number of samples is more than enough. I plan to create a raster layer by interpolating the data using either Inverse Distance Weighting or Spline techniques. I can't decide on the best grid/pixel size to use. Is there a certain tull of thumb given an `x` number of samples and a `y` size of the study area to determine the best grid size to use?


How to send data from my application to QGIS?

I have an application that makes analysis on maps . After making analysis I have new map in my application. My application doesnt use QGis API. How can I send results back? Should I construct object QgsVectorLayer from my application and send new maplayer to QGis? What approach is better to use? I want to create a plugin for QGis to work with my application and use TCP IP protocol. My application will be SERVER and QGis plugin CLIENT. My application works with graphs. It accepts .mif files. Could I construct QgsVectorMaplayer from points, lines and polygons?


Export and edit annotation featureclass using arcpy

I would like to convert labels to annotations and make some advanced editing for these labels using ArcPy. How would I do this? I'm using a file geodatabase and ArcMap 10. Any help, please.


My house address isn't listed on Google Maps

When I search for my address on Google Maps it cannot be found which means I can't order takeaway etc. Is there a way of adding my address to Google Maps or even add a street address? I want the address to be publicly available so others can search it.


ArcGIS Cost Path Analysis - How Is Arcpy Cost Path Analysis Tool So Much Faster Than ArcObjects

Although I love slinging some python to create geoprocessing scripts/services, I was under the impression that using ArcObjects to do the equivalent operation(s) will have better performance. I've made one (or two) posts over the past couple of days regarding my woes with getting geoprocessing scripts that use Spatial Analyst tools to work as geoprocessing services. My deadline is fast approaching, so I have decided to go the SOE route to achieve the desired functionality. Getting a cost path analysis in ArcObjects was relatively straight-forward using the .NET ESRI.ArcGIS.SpatialAnalyst.RasterDistanceOpClass, specifically the CostDistanceFull() and CostPath() Methods. UPDATE: Some code snippets of how I am doing things: > Python               # Get Cost Path Origin and Destination Points     inputPointsShp = 'D:/RasterStuff/test_points.shp'     arcpy.MakeFeatureLayer_management(inputPointsShp,"origin",' "TYPE" = \'ORIGIN\' ')     arcpy.MakeFeatureLayer_management(inputPointsShp,"destination",' "TYPE" = \'DESTINATION\' ')          # Check out the ArcGIS Spatial Analyst extension license     arcpy.CheckOutExtension("Spatial")          # Execute CostDistance     outCostDistance = CostDistance("origin",SOURCE_RASTER,"#","backlink")          # Execute CostPath     outCostPath = CostPath("destination", outCostDistance,"backlink")          # Convert Result to Polyline     arcpy.RasterToPolyline_conversion(outCostPath, "leastCostPath")     featSet = arcpy.FeatureSet("leastCostPath")      > C#               IDistanceOp distanceOp = new RasterDistanceOpClass();     IRasterBandCollection costDistanceRaster = (IRasterBandCollection)distanceOp.CostDistanceFull((IGeoDataset)sourceFc, (IGeoDataset)raster, true, true, false);     IRasterBand distanceRaster = costDistanceRaster.Item(0);     IRasterBand backLinkRaster = costDistanceRaster.Item(1);          IGeoDataset costPath = distanceOp.CostPath((IGeoDataset)destFc, (IGeoDataset)distanceRaster, (IGeoDataset)backLinkRaster, ESRI.ArcGIS.SpatialAnalyst.esriGeoAnalysisPathEnum.esriGeoAnalysisPathForEachCell);      A cost path analysis in ArcPy (using sa.CostDistance and sa.CostPath) takes approx 15-20 sec. Using the exact same inputs, the ArcObjects based routine takes 55-60 sec. Even using the .NET Geoprocessor is significantly slower than arcpy. So, I guess my questions here are:   1. Are the ArcPy and ArcObjects implementations pointing at the same code base (through their Python and .NET wrappers)?   2. Any tips to optimize ArcObject based Cost Path analysis?


How to make line width scale-dependent

Is there a way to tie line width to map scale in QGIS? All I found was an outside limit for display as the scale decreases. I'm using an outline line style for roads, and the roads are too big when I zoom out. What about converting them to a raster layer?


Is ST_GeomFromText better than providing direct geometry?

I have been working with postgis recently,and in my query if I use ST_GeomFromText it execute faster than running a sub-query to get geom. I thought ST_GeomFromText will be more expensive but after running many tests every time I got the result faster, my question Is there any explanation behind this? because for me getting the geom directly in sub-query is better than getting geom as text then added as GeomFromText. Thanks


How to calculate the average value of a raster within polygons?

I am using the GRASS plugin in QGIS. I am trying to calculate the average value of a raster dataset within a set of polygons. I have created a new mapset and have imported both the vector and raster layers into the GRASS mapset. I am now trying to calculate the set of statistics using the v.rast.stats tool. It starts to run and then comes up with the error _an error occurred while converting vector to raster_ and then _'raster map not found'_.               v.rast.stats raster=secant_grass@zonalstats     vector=plots_grass@zonalstats     colprefix=g/Applications/GRASS-6.4.app/Contents/MacOS/scripts/v.rast.stats:     line 190: 632 Segmentation fault v.to.rast in="$VECTORFULL"     out="${VECTOR}_$TMPNAME" layer="$GIS_OPT_LAYER" use=cat type=area     --quiet ￼An error occurred while converting vector to raster ￼Raster map not found ￼ nothing removed Finished with error      Any help would be greatly appreciated. Regards


Python and Data driven pages - Advanced use

I need to make a number of maps where only one input changes (a layer with the range of a radio tower) and I want to add the layer, apply symbology, zoom to it, change the title to include the name of the tower and then export it as a pdf with the tower name. Rather than adding the layers and applying symbology I can just put all the towers in a Group Layer and then the script can just turn all but one of them on, zoom, print and then turn it off and continue to the next tower. One long way is using: Data Driven Pages --> Page Definition option in the Definition Query tab of a Layer's Properties and specifying this but I was wondering if there was an easier work around? ![enter image description here](http://i.stack.imgur.com/s5r93.jpg) The issue with using Page Definitions is that some towers overlap and it means that I have to add in a column which will have have the tower name and signal strength repeatedly for each row. Given that we have more than 30 towers, even in a model this is laborious process that has to be then repeated when any base data changes.


Display problems in some layers of Geoserver 2.3.1

I deleted Geoserver 2.2-SNAPSHOT and deleted tomcat6. Set tomcat7 (from ubuntu repository) and Geoserver 2.3.1. Rewrote his workspce (store, style ..), changing the owner to tomcat7. Some layers are not displayed. The database remains exact same (PostgreSQL9.2 / PostGIS1 .5) Ubuntu server 12.04. Style               <?xml version="1.0" encoding="UTF-8"?>     <sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" version="1.0.0">         <sld:UserLayer>             <sld:LayerFeatureConstraints>                 <sld:FeatureTypeConstraint/>             </sld:LayerFeatureConstraints>             <sld:UserStyle>                 <sld:Name>Продорожная полоса</sld:Name>                 <sld:Title/>                 <sld:FeatureTypeStyle>                     <sld:Name>group 0</sld:Name>                     <sld:FeatureTypeName>Feature</sld:FeatureTypeName>                     <sld:SemanticTypeIdentifier>generic:geometry</sld:SemanticTypeIdentifier>                     <sld:SemanticTypeIdentifier>simple</sld:SemanticTypeIdentifier>                     <sld:Rule>                         <sld:Name>default rule</sld:Name>                         <sld:MinScaleDenominator>1.0</sld:MinScaleDenominator>                         <sld:MaxScaleDenominator>50000.0</sld:MaxScaleDenominator>                         <sld:PolygonSymbolizer>                             <sld:Fill>                                 <sld:GraphicFill>                                     <sld:Graphic>                                         <sld:Mark>                                             <sld:WellKnownName>hatch</sld:WellKnownName>                                             <sld:Fill/>                                             <sld:Stroke>                                                 <sld:CssParameter name="stroke">#808080</sld:CssParameter>                                                 <sld:CssParameter name="stroke-width">3.0</sld:CssParameter>                                             </sld:Stroke>                                         </sld:Mark>                                         <sld:Size>3.0</sld:Size>                                     </sld:Graphic>                                 </sld:GraphicFill>                                 <sld:CssParameter name="fill">#D95F02</sld:CssParameter>                                 <sld:CssParameter name="fill-opacity">0.5</sld:CssParameter>                             </sld:Fill>                             <sld:Stroke>                                 <sld:CssParameter name="stroke">#FFFF00</sld:CssParameter>                                 <sld:CssParameter name="stroke-dasharray">20.0</sld:CssParameter>                             </sld:Stroke>                         </sld:PolygonSymbolizer>                     </sld:Rule>                 </sld:FeatureTypeStyle>             </sld:UserStyle>         </sld:UserLayer>     </sld:StyledLayerDescriptor>      Geoserver log > org.apache.wicket.WicketRuntimeException: Error attaching this container for > rendering: [MarkupContainer [Component id = extraStyles]] at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1765) > at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at > org.apache.wicket.extensions.markup.html.form.palette.Palette.onBeforeRender(Palette.java:191) > at org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at > org.apache.wicket.Component.beforeRender(Component.java:1105) at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) > at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at > org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at > org.apache.wicket.Component.beforeRender(Component.java:1105) at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) > at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at > org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at > org.apache.wicket.Component.beforeRender(Component.java:1105) at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) > at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at > org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at > org.apache.wicket.Component.beforeRender(Component.java:1105) at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) > at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at > org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:151) > at org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at > org.apache.wicket.Component.beforeRender(Component.java:1105) at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) > at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at > org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at > org.apache.wicket.Component.beforeRender(Component.java:1105) at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) > at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at > org.apache.wicket.extensions.markup.html.tabs.TabbedPanel.onBeforeRender(TabbedPanel.java:244) > at org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at > org.apache.wicket.Component.beforeRender(Component.java:1105) at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) > at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at > org.apache.wicket.markup.html.form.Form.onBeforeRender(Form.java:2056) at > org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at > org.apache.wicket.Component.beforeRender(Component.java:1105) at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) > at org.apache.wicket.Component.onBeforeRender(Component.java:3946) at > org.apache.wicket.Page.onBeforeRender(Page.java:1531) at > org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at > org.apache.wicket.Component.beforeRender(Component.java:1105) at > org.apache.wicket.Component.prepareForRender(Component.java:2292) at > org.apache.wicket.Page.prepareForRender(Page.java:1521) at > org.apache.wicket.Component.prepareForRender(Component.java:2329) at > org.apache.wicket.Page.renderPage(Page.java:892) at > org.apache.wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:186) > at > org.apache.wicket.request.target.component.PageRequestTarget.respond(PageRequestTarget.java:58) > at > org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105) > at > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1258) > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) at > org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at > org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484) at > org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:160) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at > javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at > org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:159) > at > org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) > at > org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) > at > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) > at > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) > at > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) > at > org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at > javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > at > org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:27) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > at > org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:74) > at > org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:45) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > at > org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:49) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > at > org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68) > at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116) > at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72) > at > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68) > at > org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72) > at > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > at > org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:53) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68) > at > org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72) > at > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91) > at > org.geoserver.security.filter.GeoServerUserNamePasswordAuthenticationFilter.doFilter(GeoServerUserNamePasswordAuthenticationFilter.java:115) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68) > at > org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72) > at > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68) > at > org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) > at > org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:46) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72) > at > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) > at > org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173) > at > org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:103) > at > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) > at > org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:75) at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:42) at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > at > org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:47) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) > at > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) > at > com.googlecode.psiprobe.Tomcat70AgentValve.invoke(Tomcat70AgentValve.java:38) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) > at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) > at > org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) > at > org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) > at > org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > at java.lang.Thread.run(Thread.java:724) Caused by: > java.lang.NullPointerException at > org.geoserver.wms.web.publish.StyleNameRenderer.getIdValue(StyleNameRenderer.java:21) > at > org.apache.wicket.extensions.markup.html.form.palette.component.Recorder.initIds(Recorder.java:116) > at > org.apache.wicket.extensions.markup.html.form.palette.component.Recorder.onBeforeRender(Recorder.java:87) > at org.apache.wicket.Component.internalBeforeRender(Component.java:1071) at > org.apache.wicket.Component.beforeRender(Component.java:1105) at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) > ... 140 more


Rendering order of layers in QGis libraries

I am using the QGis libraries in a external Qt App. When adding vector and raster layers (in any order) to the QgsMapLayerRegistry instance, it somehow sorts the layers so that the vector layers is first in the QgsMapLayerRegistry.mMapLayers list and then the raster layers. Which make perfectly sense otherwise at render time you wont see the vector layers if the order was the other way round. But when adding a vector point layer with a memory data provider, i would like the layer to be first in the list, or at least "sorted" with the other vector layers. But is always end up last in the QgsMapLayerRegistry.mMapLayers list, and at render time it always gets rendered "beneath" the raster layer, how can i add the vector point layer with the memory data model, to be rendered "on top" of all other layers?


ArcPy space in textfield

I got a tiny script:               def calc(value):      if value is '123':         return 'ok'      elif value is '12 3':         return 'not_ok'      else:         return value      if the value is without spaces it works perfectly, but if there is a space in it, it just returns the value. Where is my error? :)


How to multiple select and delete in ArcCatalog?

I have so many files to delete, to do that I am using ArcCatalog but I can do only one by one. Is there any way to delete many files at the same time. Also, I would like to know how to select more than files in Arc catalog as well.


How to count polygons in multipart features?

I'm trying to count the number of polygons in a multipart feature. My aim is to have a 'count' attribute to quantify fragmentation of multipart land parcels. I've looked at the field calculator and for suitable plugins, but can't see anything that would help. There are lots of ways to count points, lines and vertices, but not polygons.


Access to custom GeoJSON members in OpenLayers

I need to read a layer-wide attribute, from a GeoJSON file, set by a custom member to the object:               {"type": "FeatureCollection", "features": [...], "search_polygon": "POLYGON (...)"}      Since it seems neither the Vector Layer nor the Layer classes have any attribute or method to expose this data, I tried to use the callback from HTTP Protocol with no success. (I put an alert to the callback function, but no response.) My question is: Is there any way to access that `search_polygon` custom member using OpenLayers?


How to speed up an st_intersects() query?

I have a "huge" spatial database: 72GB, 200 millions documents with geometries (points) I have a GIST index on the geometries the database:               CREATE TABLE resources     (     id bigint NOT NULL,     accuracy varchar(3),     owner varchar(100),     title varchar(500),     posted timestamp,        nbtags int,     url text,     description text,     rawtags text,     tags text,     geom geometry NOT NULL,     CONSTRAINT resources_pkey PRIMARY KEY (id)     );      INDEX resources_index_rep ON resources USING GIST (geom);          CREATE RULE resources_rule AS ON INSERT TO resources     WHERE EXISTS(SELECT 1 FROM resources                 WHERE id =NEW.id)     DO INSTEAD NOTHING;      Of course I want to query this database. Nevertheless, it's very very slow ... (I did analyzes and Vacuums) for example with area of France:               EXPLAIN ANALYZE     SELECT count(*)      FROM resources     WHERE st_intersects(st_geomfromtext('POLYGON((-5.134723 41.364166,-5.134723 51.09111,9.562222 51.09111,9.562222 41.364166,-5.134723 41.364166))',4326), geom)          QUERY PLAN     Aggregate  (cost=14411182.45..14411182.46 rows=1 width=0) (actual time=17368911.185..17368911.186 rows=1 loops=1)      ->  Bitmap Heap Scan on resources  (cost=890493.27..14391392.83 rows=7915848 width=0) (actual time=2627029.235..17357552.440 rows=21381758 loops=1)         Recheck Cond: ('0103000020E6100000010000000500000077137CD3F48914C05628D2FD9CAE444077137CD3F48914C0562B137EA98B4940F52EDE8FDB1F2340562B137EA98B4940F52EDE8FDB1F23405628D2FD9CAE444077137CD3F48914C05628D2FD9CAE4440'::geometry && geom)         Filter: _st_intersects('0103000020E6100000010000000500000077137CD3F48914C05628D2FD9CAE444077137CD3F48914C0562B137EA98B4940F52EDE8FDB1F2340562B137EA98B4940F52EDE8FDB1F23405628D2FD9CAE444077137CD3F48914C05628D2FD9CAE4440'::geometry, geom)         ->  Bitmap Index Scan on resources_index_rep  (cost=0.00..888514.31 rows=23747545 width=0) (actual time=2626090.609..2626090.609 rows=21381788 loops=1)               Index Cond: ('0103000020E6100000010000000500000077137CD3F48914C05628D2FD9CAE444077137CD3F48914C0562B137EA98B4940F52EDE8FDB1F2340562B137EA98B4940F52EDE8FDB1F23405628D2FD9CAE444077137CD3F48914C05628D2FD9CAE4440'::geometry && geom)     Total runtime: 17368946.473 ms     7 row(s)      it took almost 5 hours. and with Switzerland:               EXPLAIN ANALYZE     SELECT count(*)      FROM resources     WHERE st_intersects(st_geomfromtext('POLYGON((5.96611 45.829437,5.96611 47.806938,10.488913 47.806938,10.488913 45.829437,5.96611 45.829437))',4326), geom)          QUERY PLAN     Aggregate  (cost=5623425.68..5623425.69 rows=1 width=0) (actual time=6798842.064..6798842.064 rows=1 loops=1)     ->  Bitmap Heap Scan on resources  (cost=88982.29..5621452.65 rows=789212 width=0) (actual time=783383.496..6797250.482 rows=2539057 loops=1)         Recheck Cond: ('0103000020E61000000100000005000000AF5A99F04BDD1740D28BDAFD2AEA4640AF5A99F04BDD174028F38FBE49E74740B22D03CE52FA244028F38FBE49E74740B22D03CE52FA2440D28BDAFD2AEA4640AF5A99F04BDD1740D28BDAFD2AEA4640'::geometry && geom)         Filter: _st_intersects('0103000020E61000000100000005000000AF5A99F04BDD1740D28BDAFD2AEA4640AF5A99F04BDD174028F38FBE49E74740B22D03CE52FA244028F38FBE49E74740B22D03CE52FA2440D28BDAFD2AEA4640AF5A99F04BDD1740D28BDAFD2AEA4640'::geometry, geom)         ->  Bitmap Index Scan on resources_index_rep  (cost=0.00..88784.99 rows=2367636 width=0) (actual time=782664.847..782664.847 rows=2539063 loops=1)               Index Cond: ('0103000020E61000000100000005000000AF5A99F04BDD1740D28BDAFD2AEA4640AF5A99F04BDD174028F38FBE49E74740B22D03CE52FA244028F38FBE49E74740B22D03CE52FA2440D28BDAFD2AEA4640AF5A99F04BDD1740D28BDAFD2AEA4640'::geometry && geom)     Total runtime: 6798852.955 ms     7 row(s)      it took almost 2 hours. I'm looking for how to improve the performance? About our server:               - CPU: 4     - RAM: 16 GB     - OS: Ubuntu 12.04 LTS 64bit


compound variables in model builder?

I'm trying to create a model wherein one of the parameters is a compound variable, that is made of multiple variables joined together. How can this be done? For Example: Create an insider buffer using _Buffer(analysis)_ and name the output feature class from the distance parameter. Variables:               BufferDistance = 1000     InputFC = d:\test.gdb\boundaries      Buffer tool parameters:               Input Features = %InputFC%     Output Feature Class = %InputFC%_%BufferDistance%     Distance = -%BufferDistance% Meters      A negative buffer distance is needed to create an inside buffer, but that means the %BufferDistance% variable can't be used in the output FC name. Thus the need for a compound variable.


Show vehicle traveled route as animation

> **Possible Duplicate:**   >  Animate feature in openlayers I create map web app with openlayers and yii php framework.   I want to show vehicle traveled route as animation like below site in my application.   http://mstrackweb.mobil-i.com   In the above site use demo/demo for login to site.In the history tab you can see traveled route of vehicles as animation.   In my app i can add markers to map after 2seconds with below code.In the history array i have lon/lat and dateTime of the vehicle as location history.               var idx = 0;     var interval = setInterval(function(){         if(idx >= history.length)             clearInterval(interval);         else{             markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(                 history[idx]['longitude'],history[idx]['latitude'] ).transform(             new OpenLayers.Projection("EPSG:4326"),             new OpenLayers.Projection('EPSG:900913')                 ),icon.clone()));             idx++;         }     },2000);      But if a marker is out of the map bound i don't know how to change the bounds of the map to showing added marker!.   how can i change bounds of the map to showing added marker?   is this approach is true? When a marker added to map create event and if this marker isn't in the map bounds change map bound to showing it.   Is there any library for showing vehicle traveled route as animation?


Qgis crash on ubuntu precise

ubuntu precise qgis 1.8 I open a shape file and qgis crashes hard. i.e. it completely disappears from my desktop. qgis stable version is what i am using. (1.8)


How do I split polygons that cross the dateline?

I have a dataset of country borders which I obtained from: http://thematicmapping.org/downloads/world_borders.php/ I have that dataset in both shp and SQL, but I'll put out there that I don't feel that affects my problem; however, please let me know if it does/can. Because I'll be displaying those borders in something that uses Google Maps, I've got a problem. That problem is that countries whose polygons cross 180 degrees are displaying extremely weird in Google Maps. Either it's splitting them completely wrong, taking them all the way across the map, whatever the weirdness might be. So, I thought I can simply address this by splitting the polygons of the countries that cross the line so that no country contains a polygon that presents a problem. Examples of such countries/regions would be Russia and Antarctica. I therefore invoked the following: ogr2ogr -wrapdateline -t_srs EPSG:4326 new countryBorders.sql I got: ERROR 1: TopologyException: found non-noded intersection between LINESTRING (-59.7742 -72.9003, -59.8494 -73.2331) and LINESTRING (0 -73.1221, -89.3211 -73.0542) at -59.8141 -73.0766 ERROR 1: TopologyException: found non- noded intersection between LINESTRING (-59.7742 -72.9003, -59.8494 -73.2331) and LINESTRING (180 -73.2589, -89.3211 -73.0542) at -59.8141 -73.0766 A few questions: 1: am I even doing this the right way? for example, I find it odd that I have to provide ogr2ogr the same srs as of the input. Is that translation even needed? Is that even the right SRS to use? I obtained that SRS from taking the .prj file and looking it up on this site: http://prj2epsg.org/search 2: all I want is for a few of the polygons of those few troublesome countries to get split so they don't cause any more problems. -wrapdateline seemed like the perfect solution ... maybe it's not? I'm completely open to advice, suggestions, references, whatever. I am perfectly willing to redo this dataset in another projection, run a one- time query against it to redo it so it is more compatible with displaying on Google Maps, anything at all. I'd love any advice. It doesn't have to involve my most probably incorrect approach outlined above. Thanks so much in advance!


Automatic Watershed Delineation

I am trying to delineate watersheds automatically using Arcgis/Achydro. I got the drainage area contribution of stream segment (part of stream) as shown in figure stream. The corresponding drainage area as shown in figure area. But I am looking for drainage areas/catchment areas as shown in figure Water Shed. In watershed figure , at any point on the stream, it calculates drainage area by considering entire upstream length of the stream. Suppose, if you choose point "8", its catchment/drainage area covers the area of points "9" and "10". Similarly for point "5" covers all points upstream of stream. I want to get similar automatic watershed delineations. Please guide me to the software/method to get the result as shown in figure watershed for my entire stream network of an area. ![Stream](http://i.stack.imgur.com/z8CBY.jpg) ![Area](http://i.stack.imgur.com/2VE8t.jpg) ![WaterShed](http://i.stack.imgur.com/hENfm.jpg)


Using M 'Measure' value in SQL Server 2008

MS Sql Server 2008 geometry type supports adding Z and M values to geometry objects, including linestrings. However, I cannot find any way to make use of these values, since methods such as `.STIntersection()` return a 2D point. My end goal is to find where a given point intersects with a linestring and then find the equivalent Z and M values. Googling and scouring Technet has yielded no useful information other than to make me wish I was using PostgreSql instead, which seems to include the functionality I require (unfortunately I am constrained to Sql Server). Does anyone know how to actually make use of the Z and M values within linestrings, or of any toolsets that provide this functionality?


Remove lock on feature class

When i try to delete a feature class , after or during the use of an Arcgis engine app which uses the same feature class i got an error concerning the lock , so i can't get ride of this lock until i restart the computer. i would like to know a way to remove locks using arcpy or arcobjects 10.1 , it would be perfect if i can get ride of the lock inside the arcengine app which also locks the geodatabase , i have seen different posts in SE about locks but no one of them gives the solution to free locks using Arcobjects. Any help please


ArcMap 10.1 Python split inconsistent string

I converted a kml file to a feature class. All of the fields from the kml were combined into two fields in the feature class. One of them contains information delimited by "/" and the other contains information delimited by "br". I need to extract all of the information into separate fields. I met with some luck using the methods described here: ArcGIS 10 Python split string The problem is that the nothing is consistent about the information in the fields except for the delimiter. Some rows only contain one piece of information (no delimiter) and others contain up to five. When I use .split with a [0] to return the first piece of information it works fine, when I try to return the second piece [1] I get an error. If I get rid of the data that does not contain a delimiter then [1] works, but I don't know of a way to get rid of all of it. I am very new to ArcMap, and I am aware that I'm probably not using the correct terminology. I have read a lot of forums, looked at python dictionaries ( for example: http://docs.python.org/library/string.html) and tried to make this work over the course of many hours. The bottom line is that I still don't understand Python well enough to come up with something that works on my own! Please help me!! I tried to post images showing what I have tried and what my data is like, but I can't because I am a new user. If you think you have any ideas I would love to share more info. Thanks!


Query a polyline layer using arcGIS's Javascript API

I'm attempting to query a polyline layer using the ArcGIS Javascript API I all ready have a lot of experience doing this with Point layers. So I set my Polyline layer up the same way and stopped and started my service again to get every thing going. When I run the query (specifically when I run PolylineQueryTask.execute()) I get an error that just says the operation can't be completed. There is some code below that shows how I'm setting my query layer up. Any ideas on what I can do to fix this issue or things I should try?               PolylineQueryTask = new esri.tasks.QueryTask("http://" + DomainAddress + "/ArcGIS/rest/services/SNND/MapServer/1");          PolylineQuery = new esri.tasks.Query();     PolylineQuery.returnGeometry = true;     PolylineQuery.outFields = ["ObjID"];          PolylineQuery.where = 'where 1 = 1';     PolylineQueryTask.execute(PolylineQuery, ShowPolylineResults, FatlError);      So as you can see from my code I should be getting all my polylines back. Any thoughts are very appreciated.


Can anyone point me to good development environment in linux for client side search with flex or javascript?

I want to create a client in mapfish, and/or opengeo, using open layers, maybe cartaro and would like to play in a development environment using flex or javascript. I need to take my data, make it searchable from table columns and features, and be able to search strings for geolocation content, any good tuts, links, or linux development environments that you could recommend?


How can I fix QGIS 1.8 startup issues due to missing qwt5.dll library?

I installed the QGIS 1.8 a couple of weeks ago and it run ok. Today the qwt5.dll library is missing apparently. I deinstalled and also deinstalled the microsoft visual c++ 2005 distributables to do a clean new install but nothing seems to work. Windows 7 64 bit .exe


How can I programmatically display the "Create Features" dockable window in ArcMap 10?

When I start editing in ArcMap 10, by default the "Create Features" window is automatically opened and docked. Stopping the edit session hides this window. When I use the IEditor:StartEditing method this does not display the "Create Features" window however if it is already displayed the IEditor:StopEditing method hides it. How can I Start Editing programmatically and display the "Create Features" window? ![alt text](http://i.stack.imgur.com/wUgWw.jpg)


I have several layers (polylines and polygons) that are of the same area but they don't overlap in ArcMap as they should, what do I do?

For my GIS project for my class, I have downloaded several vector layers from different websites (polyline of the continental divide, a boundary polygon of New Mexico, a rivers and water bodies layer of the United States, etc.). Obviously, these features in real life are associated with each other but when I import each of these shapefiles into ArcMap they are not overlapping as they should (i.e the continental divide does not cut through the U.S. polygon or the New Mexico polygon). I noticed that the scales for each shapefile are completely different from each other (i.e. 1:143 vs. 1: 4,203,394), is this the problem and if so does anyone know who to fix this, and if not, does anyone know what the problem I am having actually is and how to fix it.


Intergraph TerramapServer and PostGIS

Has anyone ever used the two of them together, and if so, any special caveat to be aware of ? Furthermore, does it even make sense to use PostGIS / do TerramapServers have their own storage format instead ?


Register as versioned with move edits to base - when not to?

What limitations do I get, when I chose to register as versioned with the option to move edits to base?


Why doesn't the gml 3.1.1 schema validate with xmllint?

Running xmllint on the gml 3.1.1 schema fails, even though the release notes claim that this release was created to get the schema to validate using 'common tools'. There's questions about this on the web, but no satisfying answers.               xmllint --schema http://schemas.opengis.net/gml/3.1.1/base/gml.xsd \             --noout foo.xml      returns something like: > element complexType: Schemas parser error : local list type: A type, derived > by list or union, must have the simple ur-type definition as base type This is not the same problem as the one described here, which was a Xerces C++ issue. ~~If there is some other xmllint issue here, what xml validator is known to work with GML?~~ I have this problem on a few different flavors of Ubuntu, CentOS, and RHEL 5.x **Update:** The 3.1.1 and 2.1.2 GML schemas validate using the following tools:   1. The W3C XML Schema Validator   2. Sun's msv:  running `java -jar msv.jar -warning gml\base\gml.xsd` returned 1 warning about "anyType" in gmlBase.   3. Using the validator bundled in eclipse worked with no errors or warnings.


'GIS' grade mobile mapping app that isnt ArcPad?

I am a GIS analyst/geologist with a mining company based in Canada. However most of my fieldwork is in remote places with minimal access to the internet. I am after a reliable alternative to ArcPad and ESRI running on either ipad or android tablets. I have already tried several apps like Mapitfast and cartomobile but Ive been unimpressed with either their UI and/or inability to share/access data off the device. Some tools I need are:   * Creating rock outcrop maps   * Editing/importing geology polygons   * GPS tracking that can be exported for later use   * Photo-tagging would be a plus   * Bing or Google as a background image Thanks in advance. -David-


Extract pixel value for corresponding gps location in R

I have animal gps data with several locations for each day and regular gaps of several days when no location of the animal was recorded. Additionally, I have satellite data in intervals of 16 days. I would now like to **extract the pixel value** that corresponds to the **specific point** and to the **specific time**. This means if the location of the animals was recorded e.g. 2 days before a satellite image was taken, I want to extract the pixel value of this image (that comes after) rather than from the images that was taken 14 days before the animal location was recorded. I always want to extract from the image that lies closer according to the time. I created some test data that hopefully illustrates the problem:               library(sp)     library(raster)          ### Create test data     # create first raster     edc2012001_m <- raster(ncol=36, nrow=18)     edc2012001_m[] <- sample(1:ncell(edc2012001_m))          # create second raster     edc2012017_m <- raster(ncol=36, nrow=18)     edc2012017_m[] <- sample(1:ncell(edc2012017_m))          rasters<-stack(edc2012001_m,edc2012017_m)          # Create xy coordinates     time<-c("2012-01-01", "2012-01-01", "2012-01-01", "2012-01-02", "2012-01-02", "2012-01-02", "2012-01-12", "2012-01-12", "2012-01-13", "2012-01-13")     x <- rep(-50,10)     y <- sample(c(-80:80), 10)     data<-data.frame(x,y,time)          # Convert data to spatial points data frame     coordinates(data) <- c("x","y")          ### Extract all data from raster stack     extract(rasters, data)      The number string in the name of the first raster indicates that the image was taken on the first day in 2012, the second image was taken on the 17th day of this year. The 7th location in the test data for example shall now be extracted from the second raster file as it lies closer according to the time. All in all I have 87 raster files and 600 observations. I am really not sure how to program this. I guess I could use `substr()` to retrieve the date info from the raster names. But besides that... I am thankful for every hint I can get, also about functions that might be helpful in this context.


Using python in ArcGIS, create a line of varying distance from an origin point

What I'm trying to do is create a line feature from a single point, using a set distance and angle. Using ArcGIS and Python (I hope). Here's the scenario: Say I have a point at these coordinates: X = 400460.99, Y = 135836.76 From this point, I want to create a 800 Meter long line at a 15 degree angle from that point. I do not know what the resulting endpoint will be, which is frustrating. (My data are projected in Maryland State Plane South - Meters) Thanks for any help and suggestions. James


How to display my country's map?

I am newbie in Geomajas and I tried to create new Geomajas application using the documentation in http://files.geomajas.org/maven/trunk/geomajas/docbook- gettingstarted/html/master.html. I don't know how to display my country's map (Mongolia) in my created Geomajas application. Can you tell me how to do that or do you have any step by step guide/tutorial on this issue? Please help me


Converting tax map polygons from Shapefile to table of map number and corner coordinates

Fairfax County, Virginia provides a Shapefile here which shows the boundaries of the tax maps as polygons. Each polygon simply consists of four corners, and what I'd like to do is create a table showing the map number and the coordinates of the corners, such as the following: Map number, bottom-left, bottom-right, top-right, top-left   77-1, -77 32, -76 32, -76 33, -77 33 (though they aren't quite square like this) I don't have access to ArcGIS software, but do have QGIS and OpenJUMP, and can install any other software that is freely available. I believe this should be very easy but I'm just missing something. Thanks!


Joining lines when direction is not known

I am struggling with this problem. I have a polyline made up of several segments. Each segment is made up of points, each point identified in 3D space by coordinates and elevation. Together, if plotted, the segments make up a more or less continuous line (there could be breaks between segments), but the segments themselves are not consecutive, nor do the points of all segments follow the same direction of travel.   The question is: how can I create, using Python preferably, a single line from these non-consecutive segments so that I can measure the distance between points and the total length of the line.   I don't even know which of the segments is the first one or the last one in the line, but somehow I have to put them in the right sequence and make sure they all point in the same direction so I can measure them.   thank you for any assistance. I'll be happy to supply additional info, data, etc.. I stress I am not asking for the actual python code (not that I would refuse it...), just the strategy. Bob


How to generalize road network to be exact angle to each other?

I need to generalize a road network to be an exact angle to each other, we are talking about parallel streets like New York. The thing is that when you generalize, you do it per feature. I am trying dissolve and unsplit, but then it goes past the parallel streets and the generalization destroys curved streets. I do not want to do it manually, it is a line feature. think of one road that is straight, but the data is not. all line comes as splited in intersections. when generalizing, the output is not generalizing the hole straight road, so the road will still be full of vertexes. but when I dissolve the generalization gets better, but then if one street is changing direction at the end of the block, the topology disappears . look at the link :)https://docs.google.com/file/d/0B8sJ0k30rFr2SkNWVllWMDMxY1k/edit?usp=sharing https://docs.google.com/file/d/0B8sJ0k30rFr2TTNuLWpaNlJFY1k/edit?usp=sharing so on the brown lines you can see that within the red area the block is basically rectangular, but the end curves, so when generalising, the curve gets vertexes removed, and now it is really not straight –


Calculating slope in percentage

I'm working with qgis, v. 2.0.1. I have several soil types. They are (amongst others) described with slope indications. I already calculated the slope from the dtm in degrees, but as de description of the soil types is in percentage, I need to calculate the slope in percentage. I tried two things: first I tried the analysis tool from the raster section, but it didn't work. The result was just black with values from 0 to 0. The same happened when I tried to calculate the percentage in the raster calculator but the result was the same. Maybe I need to say that the terrain is pretty plain. What else can I do? Thanks. UPDATE: I tried the raster calculator and did what radouxju suggested. It gave me a black picture with values from 1756.64 to 1756.64. But as soon as I click in the picture the values are "normal", say 5.88 or 13.224 or something like that. The same happens when I try the gdaldem tool but with values from 0 to 0. I also tried to change the contrast enhancement (like strech to min/max) but it didn't change anything. Update 2: I just found out that maybe i have to set the scale to 111120.(http://learninggis.com/working-with-dem-models-qgis-quantum-gis) but that doesn't work neither (result: black, values 0-0).


Error with existing OSM QGIS style

I'm trying to use existing OSM style file like those of AsgerPetersen (https://github.com/3liz/osm-in- qgis/tree/master/styles/openstreetmap/geofabrik) or anitagraser's (https://github.com/anitagraser/QGIS- resources/tree/master/qgis2/osm_spatialite) but always got an error = * > " unexpected character à la ligne 31 colonne 72 " I'm on mac osX QGIS 2.2


SQL Server 2012 spatial check constraints disabled after migration from 2008

Currently we are using SQL Server 2008 geometry datatyped columns in our databases. These are registered with ESRIs enterprise geodatabase repository, so every spatial table has a check constraint which checks if the SRID of every geometry instance is equally               ([Shape].[STSrid]=(31256))      After restoring the 2008 database backup file to SQL Server 2012 for migration purposes every single of these check constraints is disabled (because of changes MS did on the spatial CLR types). As far as I can see, the interface to the CLR types is the same in this case, so I should simply be able to reenable the constraints and everything should work fine again. Are there any major issues I could run into, if I do this? At this point I can't see any obstacles.


Multivalue iteration in Vehicle Routing Problem (VRP)?

I'm currently building a model that would simulate three different set of orders (shapefile format) by using the **Vehicle Routing Problem (VRP)** tool of network analyst. The model I built runs correctly but shows me only the first delivery solution in the excel file. My aim is to have all the different route results into an Excel file (or even multiple). Does anybody know how to do that or fix the model? I also add that one issue is related to the fact that I cannot specify the input data in the delivery "Add location" during different iterations (only the first one is considered). ![enter image description here](http://i.stack.imgur.com/vWzXx.jpg)


Zero filling attributes using python

Being the AML dinosaur that I am, I am just learning python and I need to convert a 2 digit numeric attribute in a table to a 2 digit zero-filled attribute in a script. Example 9 needs to be 09. Any help would be appreciated.


How to convert GTFS to XML or JSON?

Do you know any tool that provides that? I need to manipulated GTFS file but I would like to have data available in any well-known format like XML or JSON. EDIT GTFS are Google Transit Feed Specification


I exported a DXF from QGIS, but it won't open in AutoCAD

I'm new in QGIS and here is my problem: I exported a DXf from QGIS by right-clicking on the layer. Then tried to open in AutoCAD 2000. That did not work. AutoCAD gave a failure-message: `Unknown Value "AC1018" found in drawingversion.` Then I tried to view the file in DWG-Truview2013 - which didn't work either giving the following error: `Invalid database handle 0 on line 1548. Invalid or incomplete DXF input -- drawing discarded.` Does anyone know a solution? Or is there anywhere in QGIS change the DXF- Version to export? Any Help will be useful. Thank you! Regards, Frank


Convert Shp to Dxf with QGIS

8.0. I have asked this before and seen similar but not the same (all of which I Have not got an answer to so not a duplicate). But is there a way to export a shp as a dxf so that it will not crash AutoCAD when I open it.


Fixing "spatial index grid size is invalid" without Recalculate button

I've got a python script that is connecting a squence of points to make lines, and putting them into a feature class (based on answers to my previous question). It works wonderfully on a small area that I was using to debug and test (~25 meters, 20 points), but then when I put it into a real-world scenario (~1000 meters, ~500 points), it breaks.               The spatial index grid size is invalid.      Looking into the ArcGIS help suggestions to fix/prevent that, this page suggests recalculating the spatial index grid (directions here), but my polyline feature class doesn't have that option when I am in the "Indexes" tab -- there's no "Recalculate" button at all, and the "Delete" button is grayed out. So how can I fix the error? (I tried simply deleting my original feature class and making a new one, on the theory that my original "little" test case was setting the spatial index grid too small; however, even with a brand-new feature class, I have the same error.) The problem is more specifically the number of dots I'm trying to connect during one run of the script -- less than ~50 is fine, more than ~100 is not...* ArcGIS for Desktop with Advanced level license, data stored in feature class in a file geodatabase.


How to reclassify raster data on a scale of 0-1?

I have various raster layers generated after using euclidean distance tool.   How can I reclassify them on a scale of 0-1 instead of 1-10, etc?


GeoServer and Dynamic ColorMap Extension

I am running GeoServer 2.4.3 on Centos 6 using Tomcat6. Java version 1.7.0_51 OpenJDK I am trying to install and use the DynamicColorMap community extension. I extracted the jar in to WEB-INF/lib and restarted the server as usual. On the restart I am receiving this error:               2014-04-10 21:14:42,655 INFO [geoserver.wps] - Blacklisting process ras:DynamicColorMap as the input colorRamp of type interface org.geotools.styling.ColorMap cannot be handled      Thoughts? I have cross posted this to the GeoServer user list.


How do you change starting point on a polyline? (split tool)

There must be an easy fix for this. I am using the split tool and I want it to split a polyline into equal parts. For some reason, it is starting in the middle of my polyline. How do I force it to start where I want it to? I am using ArcGIS v. 10.1.


Why do I get an empty shapefile when converting this KMZ in QGIS?

I have downloaded a KMZ file containing global elevation information. I have tried to convert the data to a shapefile using qgis (save as shape option) and using the zonum solutions website but both times the conversion has not worked. When using qgis to convert, the new shape file was empty and all attributes were 'NULL'. Any idea on how to get around this? The KML/KMZ files I am using is from the Marine Geoscience Data system and is available from their website on the following link http://www.marine- geo.org/link/download.php?data_uid=14255&client=DataLink.


OpenLayers.Format.GeoJSON throws an exception "SyntaxError: JSON.parse: unexpected character" for valid JSON

In my GeoExt client, I have the following line that retrieves JSON data from a web service into a FeatureStore:               var store = new GeoExt.data.FeatureStore({             layer: route_layer,             fields: [                 {name: "length"}             ],             proxy: new GeoExt.data.ProtocolProxy({                 protocol: new OpenLayers.Protocol.HTTP({                     url: "./php/pgrouting.php",                     format: new OpenLayers.Format.GeoJSON({                         internalProjection: epsg_900913,                         externalProjection: epsg_4326                     })                 })             })         });      When this code is executed, Firebug reports the error `SyntaxError: JSON.parse: unexpected character`, even though the JSON returned by the web service is valid (I've confirmed this against http://jsonlint.com). The response header has been configured accordingly with the line `header('Content-type: application/json',true);`. Anyone who might have encountered this issue before, please assist. I've waded around, but no luck yet. **UPDATE:** Sample JSON output is at http://pastebin.com/LPLjBDgp. It's valid JSON, but the error `SyntaxError: JSON.parse: unexpected character` persists. I've even updated my html page by adding the following line `<meta http- equiv="Content-Type" content="text/html; charset=UTF-8"/>` in an attempt to restrict character encoding.


Normalize with gdal_translate

I do not understand the command line when I try to work with gdal_translate in QGIS. I found this at the forum: Normalize raster values to 0-255 And tried this: * **"If not, from within QGIS choose Raster -> Conversion - > Translate. Choose your files and options. At the bottom of the window the full gdal_translate command will be displayed. Click edit and add the -scale option."*** When I type the following command into the line I get an error message "wrong parameters"??? Maby the commands are wrong. ![enter image description here](http://i.stack.imgur.com/kHhvt.jpg) My current grid file has a range from 1 to 9. I need to have a range from 1 to 5 (5 classes).


Importing attributes from Excel file into new Polygons

I have a constantly updated Excel file containing address information which I am currently copying into the attributes of new polygons which I am creating on a daily basis. I am currently doing this my manually by copying the address across from the Excel file each time a add a new polygon. I am looking for a way of automating this process. After producing my polygon I would like a drop down box/ or search function of a unique ID which once selected will fillout the correct attributes by pulling them from the Excel file. I am new to arcgis 10 and would have previously used the VBA editor to have a go at this (no expert). However, I see that unlike the previous versions there is not longer and VBA editor and has been replaced by python, which I am unfamiliar with. I have also spotted the model builder tool, not sure if this could be used to solve my problem? So really I'm just asking for a point in the right direction. Is there any scripts available to solve a similar problem which I can modify? Many thanks Matthew


From gpx to line segment 1Km using ArcGIS 10

I have gpx files containg points with attribute data such as time and date. I'd like to convert them into lines, and that is not a problem, but what I want to do is create 1Km segments with time and date attribute. I'm using Arcgis 10.2 Thanks ![enter image description here](http://i.stack.imgur.com/UcAsg.png)


Leaflet - how can I call custom js after drawing polygon?

I want to draw a polygon on a leaflet map and afterwards send it to the DB and retrieve all objects that intersect that polygon. In Openlayers I did it by using custom function in "featureAdded:" when declaring OpenLayers.Control.DrawFeature. How can I do the same in leaflet ? Also , Is there an easy way to add custom controls from top right to top left as in openlayers control panel ? thanks.


Geoserver and SRS

I have a very basic problem, and please bear with me since I'm new to GIS. I have geoserver installed in a Ubuntu Box and installed a few maps in shapefile. The maps were originally in ArcGIS format .mdb, but I converted them to .shp file using ogr2ogr in Windows. The maps, as known from the .prj file is using LCC projection. and geoserver correctly identifies them in `native srs` as `lcc`. But it mandates me to use `EPSG:3034` in `Declared SRS`, which again forces me to use the same SRS via OpenLayers. Isn't it the duty of WMS Server to convert projections. Shouldn't I be allowed for asking geoserver to give me map tiles in say `EPSG:4326` projection?? Please give me an insight..


Can ArcPy's AsShape be used with GeoJSON FeatureCollection of Polygons with Labels?

The AsShape documentation provides examples that work very well. However, I have been given what I believe to be valid GeoJSON that is a FeatureCollection of two polygons each with a Label. It validates fine with the JSON Formatter & Validator but when I try AsShape on it, as per the code below, it throws an AssertionError on FeatureCollection. I'm assuming that is because AsShape does not support FeatureCollections and so am wondering if there is another approach that I could use?               import arcpy          polyX2_string = {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[151.669111722222,-28.8913181547568],[151.669712422222,-28.890733765868],[151.670252222222,-28.8896441436458],[151.670847433333,-28.8891966436458],[151.670976977778,-28.8865389769791],[151.670112977778,-28.8846608880903]]]},"properties":{"Label":"National Park"}},{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[151.711278388889,-28.8201784658692],[151.710854355556,-28.8192543325359],[151.7100674,-28.8187800769803],[151.709037344444,-28.8184233992026],[151.707838755556,-28.8182234992026],[151.705821266667,-28.8180901992026],[151.705597933333,-28.8194629992025],[151.705198088889,-28.8212781880914]]]},"properties":{"Label":"National Park"}}]}          polygon = arcpy.AsShape(polyX2_string)


How do you produce a output table containing distances between mineral grains at various azimuthal directions?

I am using **ArcGIS 10** , the newest version and I am a senior at Western Carolina University and working on my senior thesis and the data set in which I have are images of mineral thin sections all separated into different groups of grains, magnetite, quartz, etc.. either being a vector layer or a raster layer. I am wanting to calculate the distance between each grain or the grain spacing, boundary to boundary, **NOT** center to center and also have those distances given every 10 degrees on a 0 to 360 degree directional scale. Is there any code out there that does this very exact method? Or is there another program, R or Fragstats, that would do a better job, ArcGIS 10 preferably. An example of the grains is shown here: ![enter image description here](http://i.stack.imgur.com/iIsQl.jpg) Thanks, -Michael Stillwagon


Access Control List for web GIS

I need to implement Access Control List (ACL) for my web application and I need to know common practice of using permissions in GIS systems. What levels of acces exists: layer, feature, attribute, extent, maybe anything else? What types of activities can be used by users: editing, browsing? Any response would be appreciated.


ArcGIS10 Split Line at Point Failing due to Dataset size

Im having an Issue with my Split Line at Point tool. Seems to run if lucky for 700 entries before arcmap/arccatalog falls over. Debugging of the errorlog has produced nothing. The total size of the line layer is 400,000 and the point layer 450000 covering the size of most states. Is there anyway I could set a python script to pull a row from current mxd, run the split line to point, to the point layer held in ram then append it to a shape/fgdb file, then loop back until complete. I have tried the various logical issues of confirming projections the same, repairing geometry, even splitting the data into 10% chunks/FCs. Also tried FME to the same result that it appears to run out of memory. Cheers. EDIT> At the moment Im tilling using Iteration by rowid using a dummy field that is populated with suburb names (spatial join population). This keeps the rows selected under 2000 each pass and at this stage seems to be working. 26/03/2012


How to find wmsURL? And how to use QueryTask method?

I have couple of questions.   1. var wmsLayer = new esri.layers.WMSLayer(wmsURL); with this line of code i can display wms layer over any base Layer. Now From where I get wmsURL ? I have published my shapefile on GeoServer, but i dont know how i get the URL (wmsURL) to use as parameter in above line of code ?    2. Now, Let's suppose I am successful to display wmsLayer. Now i want to query data against this wmsLayer. Like code below:  queryTask = new esri.tasks.QueryTask("wmsURL"); Can I use wmsURL as a parameter in QueryTask method ? From ArcGIS API reference, I come to know that the URL parameter of QueryTask method is the URL to the ArcGIS Server REST resource. But as u know i am using GeoServer, so how it could be fixed. Need some explanation ?


OD cost matrix Arcpy

I'm trying to create an OD cost matrix python script. I'm doing an OD cost matrix analysis. I'll find out the average time with patients to hospitals over 10 years. When I do this analysis, the result is that each patient visit every hospital, but in reality a patient only visit one hospitals. In my orgins table I have an attribute value HOSPITALS with the names of hospitals that can be linked to attribute value HOSPITALS in my destinations table. This means that the analysis should understand that each patient only visit a hospital. Does anyone have a tip on how I do this in arcpy?


Why does arcpy.ListFields list GUID field as SmallInteger?

I want to get a list of all GUID fields in a feature class, but it seems that arcpy.ListFields is listing my GUID field as a SmallInteger. What am I doing wrong?               global_id_fieldnames = [f.name for f in arcpy.ListFields(layer) if f.type.lower() == 'guid']      after this list was empty, I called arcpy.AddMessage() for each of the fields:               for f in arcpy.ListFields(layer):         arcpy.AddMessage('{},{}'.format(f.name, f.type))      ![enter image description here](http://i.stack.imgur.com/vyago.png)


How to correctly set the Independent Cities of Virginia in Open Street Map

I would like to use the data from Open Street Map to identify which county I am in, but I noticed something unusual with the Independent Cities of Virginia. Essentially, there are a few cities that are independent of counties, even if they are completely contained within a county. When I do a query (Via the Map Quest Geocoding API), it returns that I am in the surrounding county, and not the city. For instance, here is Augusta County, which contains two independent cities, Staunton and Waynesboro. I've seen this for a half dozen other independent cities, BTW. ![enter image description here](http://i.stack.imgur.com/G4Vni.png) It's a bit tricky to see, but Staunton has a county boundary approximating the city boundaries. When I call Staunton, it correctly shows Staunton City as the county. When I look at Waynesboro, it stays it is in Augusta, not Waynesboro City. What I'm trying to do is to figure out how to make the appropriate correction. I can see a couple of possibilities, including:   1. Somehow trace an interior boundary that matches the city of Waynesboro, and identify that county as Waynesboro City.   2. Somehow make the existing Waynesboro think it's a county. I'm not quite sure how either of those could be done, or which is the best, or even if there's a better solution all together. How can I make this correction?


How to Geocode use GeoPy API combined with GDAL Python bindings?

My question is related to the 'How to Geocode 300,000 addresses on the fly?' topic that has been asked by Mehul Nahar. I'm interested in running the processes explained by capooti in response to mehul question. I've done everything that was explained, but I was unsuccessful. Can you please let me know about the tools or components that I need to have on my computer to run the script? I have already ArcGIS 10.2, QGIS and GRASS installed. Is there any documentation related to the script?


Set Grass Region in Python grass.script

How can I set the Grass Region in Python without already having a map in the Mapset? Basically I am looking for the equivalent to this window ![enter image description here](http://i.stack.imgur.com/4MRKP.png) Currently I am only able to extent an existing region, which leads in my case to very big regions.


Bentley DGN format to Oracle Spatial

Hello did anyone ingested the DGN (all versions) to Oracle Spatial? -Rao.


how to add wms to QGis via cpp-plugin

I try to add a wms-Layer to QGIS Desktop from my plugin(c++)               QString uri= "crs=EPSG:28992&layers=natura2000:natura2000&styles=&format=image/png&url=http://geodata.nationaalgeoregister.nl/natura2000/ows?          QString myProviderName      = "wms";     QgsRasterLayer* lyr= mQGisIface->addRasterLayer(uri ,"test", myProviderName);      But in QGis i get the Message, the extent of the layer could not be calculated because of unknown dataprovider. What do i wrong? In QGIs Desktop manually adding this wms-layer is possible without problems. I also tested several other wms with same result. Thanks for all help.


How to get X and Y coordinate values of the map?

I want the `upper right` and `lower left` _coordinate_ of the exposed portion of the map, and for the whole map. What is the way to do this?


How to create cohesive Spatial Pixels from Spatial Points Dataset

I have a Spatial Point DF `spo` (covering an irregular shaped area of interest). The data are not on a regular grid due to crs transformation. My goal is a raster with predefined resolution and extent of the area of interest ( more spatial point data are to be mapped on this master raster) . Problems start when I               rasterize(spo, raster(ncol, nrow, extent, crs), spo$param)      I need to adjust `nrow`and `ncol` in a way so that I wont get moire patterns of NAs within my area of interest. I cant use a predefined (higher) resolution. As a solution to this, I thought I would need some kind of Spatial Pixel DF `spi`, that covers my whole area of interest (just like _meuse.grid_ in `library(raster); data(meuse.grid)`), and serves as a master grid. Then, I can use it to interpolate my data, e.g.               idw(param~1,spo,spi)      and by this, get full cover of my area of interest at my chosen resolution. But how can a SpatialPixelsDataFrame be produced from the point data? So in my view, the question boils down to: How to produce _meuse.grid_ from _meuse_ dataset? Maybe I'm taking the wrong approach here, so please let me know if more easily can achieved what I'm after, using a different way.


ArcGIS-Location "Location 1" in "Stops" is unlocated in Online Routing

I was trying to run a sample project "Routing" provided by ArcGis Runtime SDK. I tried the code but when the method `solve()` of `RouteTask` class is executed, it throws the following exception without returning any routes: > com.esri.core.io.EsriServiceException: Unable to complete operation. > Location "Location 1" in "Stops" is unlocated. Location "Location 2" in > "Stops" is unlocated. Need at least 2 valid stops. "Stops" does not contain > valid input for any route. I am not able to figure out what the actual problem is. Here is the link for the sample code and the code looks like this:                       map.setOnLongPressListener(new OnLongPressListener() {                  private static final long serialVersionUID = 1L;                  public boolean onLongPress(final float x, final float y) {                      // Clear the graphics and empty the directions list                 routeLayer.removeAll();                 hiddenSegmentsLayer.removeAll();                 curDirections = new ArrayList<String>();                 mResults = null;                      // retrieve the user clicked location                 final Point loc = map.toMapPoint(x, y);                      // Show that the route is calculating                 dialog = ProgressDialog.show(RoutingSample.this, "",                         "Calculating route...", true);                 // Spawn the request off in a new thread to keep UI responsive                 Thread t = new Thread() {                          @Override                     public void run() {                         try {                             // Start building up routing parameters                             RouteParameters rp = mRouteTask                                     .retrieveDefaultRouteTaskParameters();                             NAFeaturesAsFeature rfaf = new NAFeaturesAsFeature();                             // Convert point to EGS (decimal degrees)                             Point p = (Point) GeometryEngine.project(loc, wm,                                     egs);                             // Create the stop points (start at our location, go                             // to pressed location)                             StopGraphic point1 = new StopGraphic(mLocation);                             StopGraphic point2 = new StopGraphic(p);                             rfaf.setFeatures(new Graphic[] { point1, point2 });                             rfaf.setCompressedRequest(true);                             rp.setStops(rfaf);                             // Set the routing service output SR to our map                             // service's SR                             rp.setOutSpatialReference(wm);                                  // Solve the route and use the results to update UI                             // when received                             mResults = mRouteTask.solve(rp);                             mHandler.post(mUpdateResults);                         } catch (Exception e) {                             Log.w(ESRI_EXCEPTION_TAG, e);                             mException = e;                             mHandler.post(mUpdateResults);                         }                     }                 };                 // Start the operation                 t.start();                 return true;             }      I get exception on the following line: `mResults = mRouteTask.solve(rp);`