QGIS Points to Path Plugin Date/time error

I would like to use the Points to Paths plugin to plot the tracks of collared animals, exactly as specified on this page http://spatialgalaxy.net/2011/12/30/qgis-plugin-of-the-week-points-to-paths/ However, my date/time is in this format '2013/06/06 00:25' and the plugin reports this error: ValueError: Order field is not an integer type or date format is invalid I can get the plugin to work using time in HH:MM:SS only (so it's not my order field at fault) but as the animals are tracked over several days this is not practical. I cannot find in any of my three spreadsheet programs a date/time format option that uses '-' as the date separator as shown in the box? Does the plugin support my date/time format, and if so, what syntax should I use in the plugin's date format box? Or can anyone tell me how to generate a CSV file with date/time in the 2013-06-25T00:25 format that the plugin shows? Thanks! PS Am generating the date/time field by adding together separate date and time columns in the raw data


creating a dem from contours

I have a large set of contours that I received broken down into several different subsets. I have merged most of the subsets together creating a larger set of contours in three different files. I have then created three different raster datasets from the contour shapefiles, however in that process, the rasters have alot of zero elevation areas that shouldnt be there. How do I get rid of these zero elevation areas to make a more accurate digital elevation model? I was hoping the topo to raster tool would interpolate in between the different contours to clean up those areas but it did not. But, some of the zero elevation areas are in places where there is a stream, pond, or reservoir. Please help.


Slope tool error when running from arcObject add-in tool

My problem is related with Global DEM to Slope calculation. The slope tool works when raster is projected or the map is projected where the raster is added. And also, if the raster and map both are not projected, slope tool runs well but may be the result is not perfect. Problem is when I run the slope tool from my c# code and pass the raster layer to slope tool. Only when the raster is projected, the tool runs well otherwise reports a crash. In fact when the map is projected, tool reports a crash. There I could not find a way that I pass the map projection system to the tool. At the same time, when I pass a Z-factor value, why does it matter if the raster data is projected or not?


Is there a way to make a straight line in ArcEngine 10 (Polyline but with ONLY start and end)

So I want to allow the user to create a connection between 2 polygons on my map. So it doesn't make sense to allow them to draw polyline with multi points. My question is, is there a way I can do something like below BUT ONLY with 1 start and 1 end point?               private IPolyline DrawLine(IActiveView activeView, int x, int y)     {         IPolyline line = null;         IRubberBand rubberBand = new RubberLineClass();         ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();              if (activeView != null)             line = rubberBand.TrackNew(activeView.ScreenDisplay, (ISymbol)simpleLineSymbol) as IPolyline;              return line;     }      Problem is i don't want the user to have to double click at the last point, it could be confusing for user, i want them to click - create start point, click - create end point. Thanks, Kevin


ArcSDE & Oracle & Database Model -- Best diagram the system

Having Oracle dbms with ArcSDE and ArgGIS Pipeline Database Model (APDM), I would like to best describe the system with a diagram. In MS SQL each db is autonomous, I think, meaning ArcSDE(using dbo schema) has the SDE business tables in each db and further using a database model, each database has the database model implemented within?? For Oracle (oracle has a schemas instead of db's??), the Oracle instance that has the sde business tables and the database model..assigns users to participate in those tables as a sort of view (schema??) and sde manages those schemas?? My question: I would like to draw a picture showing how sde and the database model relate as well as how they sit in relation to the rdms on Oracle and on MS SQL Server. Thanks.


Are there any well symbols for ArcGIS Silverlight/WPF?

I'm looking for some standard map symbols for a silverlight app. Does anyone know where I could find these? Thanks! ![enter image description here](http://i.stack.imgur.com/HKfgU.png)


Which Address Locator types use which .cls files?

I am attempting to edit the standards file used with ArcGIS 10's geocoding engine. Unfortunately, there are 17 files! As far as this website instructs, there should be an .lot file that tells me which locator type uses which .cls files for their lookup. For whatever reason, I can't find any such .lot file OR anything else that tells me what I need to know. Has anyone else cracked this puzzle yet?


register event "loadend" on layer

I'm trying to register a listener event on "loadend" for my google maps layer on OpenLayers. But for some reason it's not firing. There must be something small i'm overlooking. What is wrong with my code? Code:               <!DOCTYPE html>                          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">          <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">          <meta name="apple-mobile-web-app-capable" content="yes">              <title>OpenLayers Google (v3) Layer Example</title>          <link rel="stylesheet" href="../js/OpenLayers/theme/default/style.css" type="text/css" />          <link rel="stylesheet" href="style.css" type="text/css" />


How to create a polygon with specified dimensions?

I'm editing a shapefile in QGIS and want to draw in a rectangle with specified dimensions(Say 101ft by 305ft for example). Is there a way in QGIS to make draw a rectangle with out actually have to use the mouse to manually place each of the points on the map? What i'm really looking for is ArcMap type functionality where the users places the first point on the map with the mouse and then the user specifies the direction and length of each point relative to the first on. Thanks!


FME Feature Provenance after a Group By

After running features through a transformer that does uses a Group By, is there a simple way to determine which destination features came from which source features? The best I could come up with is some combination of SpatialRelator and FeatureMerger, to do a spatial join on the result. Edit: For example, I have a source dataset that feeds into a BUFFERER, that I set a group-by attribute on. For each BUFFERER output feature, I wish to associate it somehow with the subset of original features that donated themselves to it. Unfortunately I don't believe the BUFFERER has a List attribute in FME Desktop 2011. How would I do this? Edit edit: bufferer, not dissolver.


How to average values in a point layer with respect to polygon layer in QGIS?

I am new to GIS and have the following problem: I have 2 layers: a point layer with a column that contains numbers (pollution index from specific measurement point) and a polygon layer with different regions. And I want to answer the following question: what is the average pollution for each region. So I need compute the mean for all points in each region. How can I do that in QGIS? Thank you very much!!


Recommendations for road maintenance management (on a small scale)

I am in a road association and we maintain our own 3 mile dirt road. In doing research on best practices for maintenance I discovered that other organizations use some mapping/GIS programs to help. I know very little about GIS in general and wonder what would be good resources to start with. **More specifically, is there a generic program I can use to create a map of the road, then use it to collaborate with others to track issues with the road, map points on it and keep a history of maintenance?** If not, is there a base for this kind of thing and can a developer build one in a reasonable amount of time? I am a software developer and would b more than happy to spend time on this project if that is required to get different pieces working. The road is in Vermont. EDIT: Basically what I am hoping for is the following:   * Software that allows me to drive a specific route and store that as a working model.   * Download some GPS/County information to automagically set elevations, etc.   * Allow multiple people to use the software and share information   * Look at historical data over time (e.g. locations of potholes, bad ice, washboarding in a certain year or month - and view that as a report) - or some other means of collecting and storing data sets and keeping them distinct in time. Please disabuse me of any unreasonable expectations or educate me on what I should be looking for.


OpenLayers GetFeature Control Mobile

I have a map that is using OpenLayers and GeoServer. I have a base layer and a WMS layer with many features. I was using OpenLayers.Control.Click to get the coordinates from the map and show a popup about the closest feature on the wms layer. This worked some of the time but it didn't always bring up the popup for the selected point. When it did work, though, it worked on desktop and mobile. So I changed to OpenLayers.Control.GetFeature. This works great on the desktop but doesn't respond at all on mobile. Can I get it to work on mobile?


How to fully load a raster into a numpy array?

I have been trying to check my filters on DEM raster for pattern recognition and it is always **resulting in missing last rows and columns(like..20)**. I have tried with PIL library, image load. Then with numpy. The output is the same. I thought, something is wrong with my loops, when checking values in array (just picking pixels with Identification in ArcCatalog) I realized that **pixel values were not loaded into an array.** So, just simply opening, puting into array and saving the image from array:               a=numpy.array(Image.open(inraster)) #raster is .tif Float32, size 561x253     newIm=Image.new(Im.mode, Im.size)     Image.fromarray(a).save(outraster)      Results in cuting away the last rows and columns. Sorry, can#t post the image Anyone could help to understand why? And advise some solution? EDIT: So, I succeeded loading small rasters into numpy array with a help of guys, but when having a bigger image I start getting errors. I suppose it's about the limits of numpy array, and so array is automatically reshaped or smth like that... So ex:               Traceback (most recent call last):       File "<pyshell#36>", line 1, in <module>         ima=numpy.array(inDs.GetRasterBand(1).ReadAsArray())       File "C:\Python25\lib\site-packages\osgeo\gdal.py", line 835, in ReadAsArray         buf_xsize, buf_ysize, buf_obj )       File "C:\Python25\lib\site-packages\osgeo\gdal_array.py", line 140, in BandReadAsArray         ar = numpy.reshape(ar, [buf_ysize,buf_xsize])       File "C:\Python25\lib\site-packages\numpy\core\fromnumeric.py", line 108, in reshape         return reshape(newshape, order=order)     ValueError: total size of new array must be unchanged      The point is I don't want to read block by block as I need filtering, several times with different filters, different sizes.. Is there any work around or I must learn rading by blocks :O


Schema Lock issue when using ITable.AddField via ArcObjects

During a process I am running, I sometimes need to create a field that is missing in an attribute table. Unfortunately, the program is complaining that the table I am adding the field to has a schema lock from _the program itself_. So I attempted to add the `ISchemaLock` method for granting an exclusive lock and I now get the HRESULT error `0x8004022D` when attempting to change the lock. Here is what the code looks like.               private void DoWork()     {             IWorkspace workspace = getWorkspacefromPath(workspacepath);             IFeatureWorkspace fWorkspace = (IFeatureWorkspace)workspace;             IFeatureClass fc = fWorkspace.OpenFeatureClass(targetfile);             if (fc == null)             {                 MessageBox.Show("No feature class found.", "Error.");                 return;             }             ITable table = (ITable)fc;             int index = table.FindField("PSTATE");             if (index == -1)             {                 ISchemaLock schemaLock = (ISchemaLock)table;                 settesttext("No PSTATE field found. Adding field now.");                 try                 {                          schemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);                     table.AddField(fielddata());                      }                 catch (Exception error)                 {                     MessageBox.Show("Field creation error. Closing process." + "\n " + error.Message);                     return;                      }                 finally                 {                     schemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);                 }                 settesttext("Field creation complete");                 index = table.FindField("PSTATE");     }      How should I go about adding the field to avoid getting a schema lock problem?


How to make PROJ4 on windows including NZ datum shift grids

Can anyone point me to an example of how to 'make' proj4 including the New Zealand datum shift grids? I understand I need to include the shift grids in the build, just not sure how to make it on windows.


How to get all intersecting points to a given area and vice-versa in PostGIS?

I'm developing a project using PostGIS to hold spatial data where I have records that hold geometry point data and records that hold geometry area data. To solve my problem I'm looking for two queries that can take geographic shapes rather than geometric shapes as parameters. For query A I need it to return all points that intersect with a given area. For query B I need it to return all areas that intersect with a given point.


Adding a marker with openlayers/geoserver

My name's Tony. I'm from vietnam. I want to add a marker in webgis with openlayers/geoserver. Here is my code :                            <link rel="stylesheet" type="text/css" href="http://localhost:8080/geoserver/openlayers/theme/default/style.css"/>
Markers Layer Example

                ## The problem I am having is that it will not show a marker,just a webmap and I don't known why. Here is what my webmap looks like: ![enter image description here](http://i.stack.imgur.com/OWZtP.jpg) Thank you for reading and helping!


How to add images containing attributes in QGIS?

I am new to QGIS. I know how to add vector and raster files into QGIS. I have some satellite images taken at different times of the same location. In addition, there are some annotation data associated with each file. I also find the eVis plugin can integrate images on locations of any vector file. The eVis display window, however, is small and cannot be zoomed in/out. Does anyone know any way that I can add my images into QGIS on the "Map View" area and be able to edit my attribute information for each image? Thanks!


Script for creating a tile-pyramid from a wms service

Given a WMS service, is there a ready-made script that, for a given extent, creates a tile-pyramid that is compliant with: http://leaflet.cloudmade.com/reference.html#tilelayer That is urls on the form:               'http://{s}.somedomain.com/blabla/{z}/{x}/{y}.png'      EDIT: I think what I want is MapProxy. I can configure a TMS layer that caches my WMS service, and copy the files that it generates.


What could be the problem with my SLD style?

I am editing an SLD style from the cookbook. I ahve a polygon layer, that I want to style according to the attribute (Name of the block). I want each block to have a different color. So I used the PropertyIsEqualTo rule but its giving me this error:               <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM "http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" >   <ServiceException>           The requested Style can not be used with this layer.  The style specifies an attribute of ID and the layer is: ECB:reds     </ServiceException></ServiceExceptionReport>      Please help.. ECB is a workspace and the layer name is reds... the attribute value that I am using is Name.               <?xml version="1.0" encoding="ISO-8859-1"?>     <StyledLayerDescriptor version="1.0.0"         xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"         xmlns="http://www.opengis.net/sld"         xmlns:ogc="http://www.opengis.net/ogc"         xmlns:xlink="http://www.w3.org/1999/xlink"         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">       <NamedLayer>         <Name>Attribute-based polygon</Name>         <UserStyle>           <Title>Attribute-based polygon</Title>           <FeatureTypeStyle>             <Rule>               <Name>ID</Name>               <Title>Nored</Title>               <ogc:Filter>                 <ogc:PropertyIsEqualTo>                   <ogc:PropertyName>ID</ogc:PropertyName>                   <ogc:Literal>NORED</ogc:Literal>                 </ogc:PropertyIsEqualTo>               </ogc:Filter>               <PolygonSymbolizer>                 <Fill>                   <CssParameter name="fill">#F5A9F2</CssParameter>                 </Fill>               </PolygonSymbolizer>             </Rule>             <Rule>               <Name>Cenored</Name>               <Title>Cenored</Title>               <ogc:Filter>                 <ogc:PropertyIsEqualTo>                   <ogc:PropertyName>ID</ogc:PropertyName>                   <ogc:Literal>CENORED</ogc:Literal>                 </ogc:PropertyIsEqualTo>               </ogc:Filter>               <PolygonSymbolizer>                 <Fill>                   <CssParameter name="fill">#F3F781</CssParameter>                 </Fill>               </PolygonSymbolizer>             </Rule>              <Rule>               <Name>ErongoRed</Name>               <Title>ErongoRed</Title>               <ogc:Filter>                 <ogc:PropertyIsEqualTo>                   <ogc:PropertyName>ID</ogc:PropertyName>                   <ogc:Literal>ERONGORED</ogc:Literal>                 </ogc:PropertyIsEqualTo>               </ogc:Filter>               <PolygonSymbolizer>                 <Fill>                   <CssParameter name="fill">#FFFFFF</CssParameter>                 </Fill>               </PolygonSymbolizer>             </Rule>              <Rule>               <Name>SouthernRed</Name>               <Title>SouthernRed</Title>               <ogc:Filter>                 <ogc:PropertyIsEqualTo>                   <ogc:PropertyName>ID</ogc:PropertyName>                   <ogc:Literal>SOUTHERNRED</ogc:Literal>                 </ogc:PropertyIsEqualTo>               </ogc:Filter>               <PolygonSymbolizer>                 <Fill>                   <CssParameter name="fill">#F6CEF5</CssParameter>                 </Fill>               </PolygonSymbolizer>             </Rule>             <Rule>               <Name>CentralRed</Name>               <Title>CentralRed</Title>               <ogc:Filter>                 <ogc:PropertyIsEqualTo>                   <ogc:PropertyName>ID</ogc:PropertyName>                   <ogc:Literal>CENTRALRED</ogc:Literal>                 </ogc:PropertyIsEqualTo>               </ogc:Filter>               <PolygonSymbolizer>                 <Fill>                   <CssParameter name="fill">#819FF7</CssParameter>                 </Fill>               </PolygonSymbolizer>             </Rule>           </FeatureTypeStyle>         </UserStyle>       </NamedLayer>     </StyledLayerDescriptor>      thats my sld.. sorry the attribute field is id.


Attribute Table Doubt in Qgis

I am having a shape file which consists of various fields for example: shape area ,shape length, locality, sub-locality,district etc.In my company they are demanding seprate shapefiles say for example sub locality shape file must have only the attributes of sub locality not any thing else like shape area, shape length etc. this is the actual problem kindly help me in solving this?


Topography: How to convert raster into vector layers?

(nb:This project is part of the #Wikipedia #wikimaps project) **1. Question:**   * **How to create vector topographic maps from raster image ?**   * **How to convert raster topographic image into closed vector polygons for the relevant levels** as seen in the illustration below ? Using commands (likely gdal) and a GIS topographic raster image, I want to produce topographic .shp maps with an elegant relief. This .shp should be made of **closed polygons** for each of the n requested level. ![enter image description here](http://i.stack.imgur.com/c3hwb.png) * * * **2. Possible direction** would be:   1. Create vector isolines (`gdal_contour -a elev -fl -500 0 500 1000 2000 4000 crop.tif contours.shp`)   2. Create a copy of the whole map area into vector polygon,   3. Cut this polygon with all isolines of level n (i.e. isolines of level 0).   4. Keep those of these polygons with a value (altitude) superior to the isoline value.   5. (merge this polygons into one shp layer of level_n.)   6. Repeat for each level. I haven't clues how to do that, but it sound promising! (should work) If you can provide the solution to one of the points 2, 3, 4, It will be really appreciated ! and I will be happy to then open a specific question where I will validate your helpful answer. * * * **3. Current workflow: gdal_contours alone is not suitable.** I currently crop my source raster ETOPO using `gdal_translate` then get levels with `gdal_contour`. Using the libs `curl`, `unzip`, `gdal`, my current worflow is as follow.               # download it:     curl -o ETOPO1.zip 'http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registered/georeferenced_tiff/ETOPO1_Ice_g_geotiff.zip'     # unzip it:     unzip ETOPO1.zip     # crop it:     gdal_translate -projwin -005.48 051.30 10.00 041.00 ETOPO1_Ice_g_geotiff.tif crop.tif     # lines for levels:     gdal_contour -a elev -fl -500 -200 0 100 200 500 1000 2000 4000 crop.tif contours.shp      Unfortunally, `gdal_contour` generates vertor iso **lines** , which are not suitable. The main trouble is with cropped areas: in the case of a close up on France, the isolines are not closing into a circle as for Islands or continents but open lines, so there are partial parts of the polygons (as the quarter of a circle) whose' relevant fill --a 1/4 pie-- appear as a filled arc (see bug below). ![End result in D3js fails due to unclosed isolines generated by gdal_contour](http://i.stack.imgur.com/rOmjc.png)


Is there any simple Map Labeling Algorithm?

I was looking into how to Label a few features on a small Map, and want to label them on the fly. I would be adding a few features (a maximum of around 6 to 7) as graphics on a web-Map which has only a hypsometric rendered DEM. I would like to label these graphics and make sure that the labels do not overlap I have looked at quite a few papers, but the algorithms look quite complicated. Is there any simple Map Labeling Algorithm that gives reasonable results?


GIS Web API - WFS-T Edit

My organization has a asset management application using Google Maps Java API as the GIS viewer. The application does some simple editing/querying on a kml file through html form elements. **Instead of editing against the kml files, can the API edit/query against a WFS-T service (served by ArcGIS Server)?** **If not, can I modify this OpenLayers WFS-T Using a GeoServer Hosted PostGIS (link below) Layerinstructions to edit against ArcGIS Server/SDE database/WFS-T?** http://www.gistutor.com/openlayers/22-advanced-openlayers- tutorials/47-openlayers-wfs-t-using-a-geoserver-hosted-postgis-layer.html               //wfs-t editable overlay     var wfs_layer = new OpenLayers.Layer.Vector("Editable Features", {     strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],     //projection: new OpenLayers.Projection("EPSG:26910"),     protocol: new OpenLayers.Protocol.WFS({     version: "1.1.0",     // loading data through localhost url path     url: "http://localhost/geoserver/wfs",     featureNS :  "http://www.opengeospatial.net/cite",     maxExtent: mapextent,     // layer name     featureType: "wfst_test",     // geometry column name     geometryName: "the_geom",     schema: "http://localhost/geoserver/wfs/DescribeFeatureType?version=1.1.0&;typename=cite:wfst_test"     })     });       Thank You!


Oracle spatial - check polygon vertices counter clockwise

I need to import a huge number of polygons from a third party (as a csv file- array of x,y's). I have to check whether the polygon vertices are in clockwise or counter clockwise, finally i have to convert it into counter clockwise and store it in the oracle spatial table as sdo geometry. I am not able to find any oracle spatial java API to check the array of vertices and convert it into counter clockwise. I tried the same question in oracle spatial forum, but they said no API for this. do you have ever worked on this oracle spatial java API, any other thoughts. ( i have found some methods to validate the ring rotation "http://paulbourke.net/geometry/clockwise/index.html", but if it is from oracle it will be good to implement).


Why doesn't pgRouting return the best path?

Let the next portion of a graph: ![enter image description here](http://i.stack.imgur.com/VcDYf.png) When I use the function shortest_path between the points A and B, I got the blue path. Why does this happen?


What does [missing] on ArcGIS 10.2 for Desktop Python addin mean?

I need to load all layer names into a combo box. I did the same using esri site. But the tool is showing [missing].


Why do I get different results running a script in PyWin and loading it to the Python shell in ArcGIS?

I've been trying to teach myself Python scripting for ArcGIS and have gotten frustrated on multiple occasions when I try to debug my script endlessly, only to later find out that it actually works properly when it is loaded into the Python shell in ArcGIS. In the past I have received a variety of errors when running the script in PythonWin, only to have the code work just fine when loaded into ArcGIS. **Why is there a discrepancy between the results of a script run in PythonWin and the Python shell in ArcGIS?** I am using:   * Windows 8.1   * Python 2.7.2   * PythonWin (pywin 32 build 214)   * ArcGIS 10.1 Advanced The script is as follows:               #    Import arcpy, env     import arcpy     from arcpy import env          ##   Enable file overwrite     env.overwriteOuput = True          #   Set workspace     env.workspace = "c:/documents/arcgis/arcgis tutorials/psu tutorials/lesson3practiceexercisea/washington.gdb"          #   Create new layer feature classes: Cities, ParkAndRide     try:         arcpy.MakeFeatureLayer_management("CityBoundaries", "CityBoundariesLayer")         arcpy.MakeFeatureLayer_management("ParkAndRide", "ParkAndRideLayer")     except:         print "Could not make new layer."      I initially did not post the code because I've had this issue before with code of various types and I was thinking this was not a code error. This code works when loaded the the Python console in ArcGIS, but now when run from PythonWin.


How to find obsolete plugin?

I just installed a brand new copy of QGIS 1.8 Lisboa and all of the associated software on a Windows Vista PC using the Windows Osgeo4W QGIS installer, and I get this message: " _The Plugin Installer has detected an obsolete plugin which masks a newer version shipped with this QGIS version. This is likely due to files associated with a previous installation of QGIS. Please use the Plugin Installer to remove that older plugin in order to unmask the newer version shipped with this copy of QGIS_." I did have an older copy of QGIS but I uninstalled it and I am 99% certain that I successfully deleted all of the associated files and directories. I notice that the Osgeo4W directories created by the OSGEO4W installer include several versions of QGIS (including 1.0 and 1.4), but I am a novice user and don't know how to figure out which plugin is causing trouble, or if this could be a bug in the Osgeo4w installer. Thanks!


How to use a sld file with Openlayers using OSM data?

My app, made with openlayers, displays building data called from overpass api.               var data_url = "http://overpass-api.de/api/interpreter?data=(way[building](bbox);node(w););out body;"; //main working url     var building = new OpenLayers.Layer.Vector("Building", {             strategies: [new OpenLayers.Strategy.BBOX({ratio:0.75})],             protocol: new OpenLayers.Protocol.HTTP({                 url: data_url,   //<-- relative or absolute URL to your .osm file                 format: new OpenLayers.Format.OSM()             }),             projection: new OpenLayers.Projection("EPSG:4326")         });      Now i need to render them according the builing tag (commercial, yes, school etc). As of now i am using the Openlayers.Style to define each class.               var stylemap = new OpenLayers.StyleMap({             "default": new OpenLayers.Style({                 strokeColor: "white",                 strokeWidth: 1             }, {                 rules: [                     new OpenLayers.Rule({                         filter: new OpenLayers.Filter.Comparison({                             type: OpenLayers.Filter.Comparison.EQUAL_TO,                             property: "building",                             value: "yes"                         }),                         symbolizer: {                             fillColor: "olive"                         }                     })                 ]             })         })      The thing is i have made a sld file from the same data using Quantum GIS.               <?xml version="1.0" encoding="UTF-8"?>                I want openlayers to read this sld file, parse and create a stylemap from it, and use the style in vector(building) layer. P.S. I hve alread gone through the Openlayers Dev Example. Edited: The full app                         <title>WebDRI</title>     <link rel="stylesheet" href="http://openlayers.org/api/2.12/theme/default/style.css" type="text/css">                                                    WEB DRI Building Structure Data Collection App Zoom In to view data


How to buffer a point in a Python Add-In by ArcMap's selection tolerance?

In this answer to another Python add-in question I suggested supplying a `search_distance` to the SelectLayerByLocation function in order to allow points and lines to be selected by an intersecting point, interactively clicked by the user using the `onMouseDownMap` method of a Python add-in `Tool` class. In ArcObjects you would normally use ArcMap's selection tolerance in pixels and expand your point's envelope by that amount in map coordinates, but I can't find any equivalent way of doing this in arcpy.   * Is there a way to access ArcMap's selection tolerance setting without using ArcObjects? And if so, how can you convert this amount to map coordinates so that you can buffer the point or select within a search distance? Or alternatively and more generally stated:   * Is there a scale-dependent way to to expand/buffer a point so that interactive selection of features with Python add-in Tools is a similar user experience to the usual interactive selection tools in ArcMap?


How to customize QGIS for vehicle tracking?

I'm doing a project on vehicle tracking using GIS - for that I'm using the open source software package QuantumGIS (QGIS). I would like to know how to customise QGIS using the python console to edit the point shape file geometries. I want the point file to get updated as the location of the vehicle changes.


Is it possible to conduct a flood model analysis with QGIS using a DEM? Need to simulate rising water levels on a 250k map.


PostGIS algorithm to unite points of two geometries that are within specified radius

I want to find an PostGIS algorithm to unite points of two geometries that are "near" to each other. That is: I want a function, that takes as input two geometries, and returns 1 geometry, that consist of points of first geometry, second geometry, and points that are in specified radius of **both** geometries. Currently I am using such function for this (tolerance radius is 2 meters): SELECT ST_AsText( ST_Buffer( ST_Union( ST_Buffer( ST_GeomFromText( 'POLYGON ((0 0, 0 4.5, -2 4.5, -2 5.5, 0 5.5, 0 10, 1 10, 1 0, 0 0))', 3301 ), 2 ), ST_Buffer( ST_GeomFromText( 'POLYGON ((2 5, 5 8, 5 2, 2 5))', 3301 ), 2 ) ) , -2) ); It works reasonably well to unite points of two geometries, that are near to each other. However, it has side effects. For example: Input geometries: ![Input geometries](http://i.stack.imgur.com/uZ4Q4.jpg) Resulting geometry: ![Resulting geometry](http://i.stack.imgur.com/OyiKO.jpg) As can be seen from picture, some extra area is added to the "blue" geometry where the obtuse angles are. This is so, because using               ST_Buffer(ST_Buffer(geom, tolerance), -tolerance)       adds extra space to places where there are obtuse angles. Is there an algorithm that would produce my asked result? Exact nature of how the two geometries are "glued" to each other is not so important. Buffering algorithm leaves smooth curve, but something like this would also be valid result (hand-drawn, I tried to add points that are in distance of 2 meters from both geometries): ![example of valid result](http://i.stack.imgur.com/7dDb2.jpg) If there are many algorithms, the fastest one will best suit my needs. But for comparison, slower algorithms will also be welcome (up-voted), if they excel by some other criteria.


Offset to symbol in WMS request

Is it possible to give offset to symbol of point feature using sld in openlayers or geoserver?


Code to open web browser crashes ArcMap when run from a Python add-in

I created an ArcMap Python add-in using ArcGIS 10.1 to open a webpage after the map is clicked. It opens the page but then ArcGIS crashes.               import arcpy     import pythonaddins     import webbrowser     class ToolClass2(object):         """Implementation for TEST_addin.tool (Tool)"""         def __init__(self):             self.enabled = True             self.cursor=3         def onMouseDownMap(self, x, y, button, shift):              mxd=arcpy.mapping.MapDocument("current")         df = arcpy.mapping.ListDataFrames(mxd)[0]         pt=arcpy.PointGeometry(arcpy.Point(x,y))         pythonaddins.MessageBox("Long" + " " + str(x) + '\n'+ "Lat"+ " " + str(y), 'Coordinates', 0)         path = 'http://pol.pictometry.com/en-us/php/default.php?lat=' +str(x) +'&lon=' + str(y)+'&v=p&o=n&type=or&level=n'         webbrowser.open(path)         pass


Looking for symbology for NAICS codes

I am curious if anyone has come up or has a good graphic style they can share that is symbology for NAICS codes. I have a large dataset that I want to symbpolize based on the 2 digit NAICS industry code, but can't any sort of good or consistent stanard.      Any good sources?


Using the Flexviewer 2.4 I want to toggle layers from one service on/off

I have 2 layers in one service. If the user clicks one on, I want the other one to turn off, and vice versa. I am using the default flexviewer LayerListWidget.mxml and assume this is the place where I would want to put the code to handle the toggle on/off event. I have seen these posts, but I am not sure it's the right code. Can someone provide me with the right code to use? Thanks in advance. esri forum 1 esri forum2


How thick in ground units is this line on a printed map?

Sometimes in discussing how accurate this that or the other thing _needs_ to be someone will make the observation that "a line shift of 30m at 1:1million scale is less the width of the line itself when printed, so, no worries". That's great! For _that_ map that is, but what about _this_ map which will be printed at 1:25,000? This got me thinking that it would be useful to have a quick reference chart of **"how thick is an Xpt line on the ground at Y scale at Z dpi?"**. A bit of searching reveals no such beast readily available online, so let's fix that! I suggest a base line of `0.2 pt` and `300 dpi` since in offset printing that's the thinnest reasonable colour line and standard dpi.


ArcGIS Server Setting proxy.ashx for javascript api - Error 403

I am trying to set up the proxy for my web application because the request exceeds 2000 characters. I set up the proxy as described in ESRI site. When I run my application I get the error as shown below               **"Unable to load http://localhost/proxy.ashx?http://T...nction/execute Status:403"**      I put my web application (one HTML page with javascript api code) and the two proxy files to my development machine's root folder. This machine is XP. I have Geoprocessing service running on another machine (TestServer). When the length of GP request exceeds the limit, the application tries to use proxy and that is when I see the error above. This machine is Win 2008. Status 403 is Forbidden page error. Appreciate if anyone can help me with this. Thanks Cyril


SQL Spatial view using a Query Layer in ArcMap 10 is SLOW

We have a number of SQL Spatial views each made up of approximately 10 tables (so relatively complex views) and each including a table with a SQL Geometry column. A view could return up to 300-400 thousand records. No SDE involved. We are using a Query Layer (QL) for each spatial view (Select * from the view) to display in ArcMap. Each spatial table has a primary key, spatial grids and uses an SRID of 0. Just to load a QL might take 10-15 seconds. To display with a 100k - 250k data view (maybe 100s of features) takes 10-20 seconds. We previous had these as SDE views (same underlying SQL views w/o the SQL spatial column) in Arc 10 and they loaded and displayed in 1-3 seconds. Anyone have ideas about why these are SO MUCH SLOWER without using SDE?


In PostGIS, how to count nearby points efficiently?

I have one dataset A with around 6K point geometries and another dataset B with around 600K point geometries. I am trying to come up with an efficient way to update dataset A with an integer representing the number of objects from dataset B that are within a certain distance (100 meters) from the point in A. The strategy I came up with did not complete overnight, so I am thinking I could be doing this more efficiently. (Or maybe this is just that expensive an operation?). I am running this on my X220 i5 laptop with SSD and 8GB RAM, Ubuntu 12.10, PostgreSQL 9.1, Postgis 2.0. This is the function I use. `nbi.testpoints` is the small dataset, `nbi.bridges` is the bigger dataset. Both tables have spatial indexes on them.               CREATE OR REPLACE FUNCTION getnearbycounts() RETURNS VOID     AS     $$     DECLARE       node nbi.testpoints%rowtype;     BEGIN       FOR node IN SELECT * FROM nbi.testpoints       LOOP         UPDATE nbi.testpoints SET closenbicount = (SELECT count(1) FROM nbi.bridges WHERE            ST_Transform(node.geom, 3785) <#> ST_Transform(nbi.bridges.geom, 3785) < 100)           WHERE nbi.testpoints.id = node.id;         RAISE NOTICE 'node % done', node.id;       END LOOP;     END;     $$     LANGUAGE PLPGSQL;      I am doing the transform to a meter-based coordinate system to be able to give a distance threshold in meters, but replacing that with an approximation in degrees and doing away with the two `ST_Transform`s does not make a noticable difference. I see a performance of 1 point processed per 10-15 seconds.


MapGuide or Mapserver for Enterprise?

Could you describe your experiences from one or the other. I've done a lot of searching and it seems more people use Mapserver but there are many people really like MapGuide a lot... Mapguide also seems to be a little behind on documentation... Latest version of documentation is 2.0 and the official release is 2.2. I've tried doing the tutorials but they seem to be behind and break, or don't work at all for the new version of MGOS. I guess my question is... What one do you recommend for an enterprise system?


How to install an old QGIS Master (1ab5cdc)?

I need to revert my current version of the QGIS Desktop Master back to 1ab5cdc (about 5 months ago). Anyone know how I can make this happen? I'm running windows XP


Geoserver - restrict access to layer by IP mask

Well the title probably describes my question - can you restrict access to an individual map layer in geoserver by an IP mask (eg. 192.17.204.0/32)? This is as opposed to firewalling the whole service, or by role authentication. Thanks in advance,


Polygon overlay with Shapely

I'm trying to capture all the non-overlapping polygons indicated below using Shapely (given polygons A,B & C). Moreover, I'm hoping to do so without iteration, testing for intersect etc. The accepted answer to this question expresses the PostGIS method but it would seem that 'union' means different things to different people. ![polygon overlay](http://i.stack.imgur.com/0AgTa.jpg)


Sum the values of a single raster and output the value as a number?

I have a floating point raster and have applied a conditional to it in order to only extract the positive values, so there are 'no data' "holes" in the raster. I simply need to sum the values from this raster and output it as a number. I came across this thread, which I'm sure some of you will recognize. Has anyone developed a working solution? I'm working in Arc10 and making use of ArcObjects if necessary. **EDIT** : I've included a VB.NET version of @Kirk's C# code. It's provided as is, but it should be a good starting point if it doesn't already completely satisfy its purpose.                   Public Shared Sub TestSumRaster()             Dim path As String = "D:\topo_modeling\topo_modeling\gis\usgs\ned_10m.img"             Dim rds = OpenRaster(path)             Dim sum As Double = SumRaster(rds)             Debug.Print("sum : {0}", sum)         End Sub              Public Shared Function SumRaster(rasDs As IRasterDataset) As Double             ' sum up each band in a raster dataset             Dim rasBandCol As IRasterBandCollection = DirectCast(rasDs, IRasterBandCollection)             Dim sum As Double = 0.0                  ' Iterate through each band of the dataset.             For i As Integer = 0 To rasBandCol.Count - 1                 sum += SumBand(rasBandCol.Item(i))             Next             Return sum         End Function              Private Shared Function SumBand(rBand As IRasterBand) As Double          ' sum up each block in a band             Dim sum As Double = 0.0             ' QI to IRawBlocks from IRasterBandCollection             Dim rawBlocks = DirectCast(rBand, IRawBlocks)                  ' Determine the tiling scheme for the raster dataset.             Dim tile = New Tile(rawBlocks.RasterInfo)                  ' NoData is array, but usually just has one value in it.             Debug.Print(rawBlocks.RasterInfo.NoData.[GetType]().ToString())                  ' Create the pixel block.             Dim pb = rawBlocks.CreatePixelBlock()                  ' Iterate through the pixel blocks.             For pbYcursor As Integer = tile.startY To tile.endY - 1                 For pbXcursor As Integer = tile.startX To tile.endX - 1                     ' Get the pixel block.                     rawBlocks.ReadBlock(pbXcursor, pbYcursor, 0, pb)                     sum += SumBlock(pb, pbXcursor, pbYcursor, rawBlocks.RasterInfo.NoData)                 Next             Next             Return sum         End Function              Private Shared Function SumBlock(pb As IPixelBlock, pbXcursor As Integer, pbYcursor As Integer, noDataValues As Object) As Double             ' sum up each pixel in the pixelblock             Dim sum As Double = 0.0                  ' Put the pixel block into a SafeArray for manipulation.             Dim safeArray = TryCast(DirectCast(pb.get_SafeArray(0), System.Array), System.Array)                  Dim noDataList = New List(Of [Single])(DirectCast(noDataValues, [Single]()))                  ' Iterate through the pixels in the pixel block.             For row As Integer = 0 To pb.Height - 1                 For col As Integer = 0 To pb.Width - 1                     Dim val As Object = safeArray.GetValue(row, col)                     Dim singVal = DirectCast(val, [Single])                          'Debug.Print(val.GetType().Name);                     If Not noDataList.Contains(singVal) Then                         sum += singVal                     End If                 Next             Next             Return sum         End Function


Empty mapper window when I open a OSGB36 shapefile in MapInfo Professional. How can I see the data?

I have a set of shapefiles which I'm trying to open in MapInfo Professional 7.8. Each of the shapefiles has a .prj file which looks like this:               PROJCS["British_National_Grid",GEOGCS["GCS_OSGB_1936"       ,DATUM["D_OSGB_1936"       ,SPHEROID["Airy_1830",6377563.396,299.3249646]]       ,PRIMEM["Greenwich",0]       ,UNIT["Degree",0.017453292519943295]]       ,PROJECTION["Transverse_Mercator"]       ,PARAMETER["False_Easting",400000]       ,PARAMETER["False_Northing",-100000]       ,PARAMETER["Central_Meridian",-2]       ,PARAMETER["Scale_Factor",0.999601272]       ,PARAMETER["Latitude_Of_Origin",49]       ,UNIT["Meter",1]      ]      When I open these files I'm asked for a projection setting, I've tried the 'Latitude/Longitude (OSGB 36)', 'British National Grid' and a fair few others but always see an empty mapper window. If I try to look at the coordinates using MapInfo Professional's SQL query options then rather strangely I see blank values for CentroidX(obj),CentroidY(obj). If I use the Universal Translator to convert one of the shapefiles to MID/MIF then I can see the coordinates, like this:               VERSION 300     DELIMITER ","      CoordSys Earth Projection 8, 104, "m", -2, 49, 0.999601272, 400000, -100000                                 COLUMNS 1         ID decimal(5,0)     DATA     LINE 534061.554 182550.177 534062.547 182550.525     LINE 534062.547 182550.525 534064.181051453 182547.058664689     LINE 535691.843 183008.914 535693.182 183007.166     LINE 534840.184 182700.747 534839.889 182701.372     LINE 536273.212731382 183548.850943691 536271.824 183548.284     LINE 533330.033439369 182375.414376181 533329.876996451 182376.898647792     (etc...)      I need to be able to edit these files in MapInfo Professional and then need to convert them to WGS84 but am rather stuck. My question is how I can open these files so that I can see and edit the data? Thanks! **UPDATE:** Having taken James S's advice most of my files are now appearing in MapInfo, great, thanks James S! But I have a small set of files which didn't work and if I convert those to MID/MIF I see a different kind of coordinates, as follows. Note that the .prj file for these shapefiles appears to be exactly the same as that above. How can I deal with these ones?                VERSION 300      DELIMITER ","     CoordSys Earth Projection 8, 79, "m", -2, 49, 0.9996012717, 400000, -100000 Bounds (-7845061.1011,-15524202.1641) (8645061.1011,4470074.53373)                                                               COLUMNS 7         ID0 char(21)         NUMBER char(254)         ID char(254)         DESCRIPTIO char(254)         STATUS char(15)         TYPE char(9)         DURATION char(10)     DATA     PLINE 65     386065100 336732200     386062540 336736210     386061790 336737010     386058060 336739750     386057400 336740120     386054630 336741240     386054180 336741470     386050910 336743490     386050660 336743630     (etc...)


circle with dfferent colours representing different criteria

I want to draw circles on maps with different colours, this gives the signal strength of the tower, suppose circle is of 50 m then first 20m should be given a color1 and next 20 m color2 and remaining color3. Is this possible in Geoserver SLD or openlayers? How?


Custom Application throws HRESULT if the MXD/MXT has layers with data source missing

This is in continuation to my previous post regarding getting ArcMap reference without launching it. The idea of the application is to map layers (pointing currently to an unreachable server; server may be down, non-operational or behind a firewall) of a MXD/MXT of a document to another data source. While I was able to achieve it, I faced a different issue as I move forward.   These are the steps I followed:   * Checkout ArcEditor license   * If checkout successful above, try connecting to _SDE.DEFAULT_   * If connection to ArcSDE successful, parse map layers   * For every layer parsed, change its source   * Finally, save map and close The issue is, as soon as I try to get the map count (data frames) in the document, the application throws a HRESULT error (see below), and I am unable to proceed. **could not be found. (Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND))** I searched the internet for this error and at some places they have talked about ArcGIS not being able to "access" a file. In this case I doubt if thats an issue... I am attaching relevant portions of the code, showing the location of the error. I am not sure where I am going wrong...need your help guys! Thanks in advance!               public static bool LicenseCheckout()         {             try             {                 int ESRILicenseCheckoutReturnCode;                 bool ReturnResult;                      //checkout ESRI license: ArcEditor                 pESRILicense = new AoInitializeClass();                 ESRILicenseCheckoutReturnCode = (int)pESRILicense.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcEditor);                      ReturnResult = false;                      switch (ESRILicenseCheckoutReturnCode)                 {                     case 10:                         //esriLicenseAvailable                         ReturnResult = true;                         break;                          case 20:                         //esriLicenseNotLicensed                         MessageBox.Show("You are not licensed to use the product!", "License Checkout Failure");                         ReturnResult = false;                         break;                          case 30:                         //esriLicenseUnavailable                         MessageBox.Show("You are not licensed to use the product!", "License Checkout Failure");                         ReturnResult = false;                         break;                          case 40:                         //esriLicenseFailure                         MessageBox.Show("There has been a licensing Failure!", "License Checkout Failure");                         ReturnResult = false;                         break;                          case 50:                         //esriLicenseAlreadyInitialized                         MessageBox.Show("The Product license has already been initialized." +                         "Initialization can only be performed once!", "License Checkout Failure");                         ReturnResult = true;                         break;                          case 60:                         //esriLicenseNotInitialized                         MessageBox.Show("License not Initialized!");                         ReturnResult = false;                         break;                          case 70:                         //esriLicenseCheckedOut                         ReturnResult = true;                         break;                          case 80:                         //esriLicenseCheckedIn                         MessageBox.Show("License ChekedIn successfully!");                         ReturnResult = true;                         break;                 }                      return ReturnResult;             }             catch (Exception ex)             {                 MessageBox.Show(ex.Message);                 return false;             }         }            public static bool ConnectToSDE(string User, string Password, string Server, string Instance)         {             try             {                 if (SDEConnectionSuccessful(User, Password, Server, Instance))                 {                     return true;                 }                 else                 {                     return false;                 }             }             catch (Exception)             {                 throw;             }         }             private static bool SDEConnectionSuccessful(string User, string Password, string Server, string Instance)         {             try             {                 pConnectionProperties = new PropertySetClass();                      pConnectionProperties.SetProperty(Constants.ARCSDE_PROPERTY_SERVER, Server);                 pConnectionProperties.SetProperty(Constants.ARCSDE_PROPERTY_INSTANCE, Instance);                 pConnectionProperties.SetProperty(Constants.ARCSDE_PROPERTY_USER, User);                 pConnectionProperties.SetProperty(Constants.ARCSDE_PROPERTY_PASSWORD, Password);                 pConnectionProperties.SetProperty(Constants.ARCSDE_PROPERTY_DATABASE, ""); //not required for Oracle connections                 pConnectionProperties.SetProperty(Constants.ARCSDE_PROPERTY_VERSION, Constants.ARCSDE_VERSION);                      pWSF = new SdeWorkspaceFactoryClass();                 pWS = pWSF.Open(pConnectionProperties, 0);                      if (pWS != null)                 {                     //connection successful                     return true;                 }                 else                 {                     return false;                 }             }             catch (Exception ex)             {                 //cleanup                 pConnectionProperties = null;                 pWS = null;                 pWSF = null;                      ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pConnectionProperties);                 ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pWS);                 ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pWSF);                      MessageBox.Show(ex.Message, "Exception");                 throw;             }             finally             {                 //nothing to release as objects will be needed later             }         }              public static void ParseMapLayers()         {             try             {                 //get a reference to ArcMap                 pMapDoc.Open(MXDFilePath, null);                  pMap = pMapDoc.get_Map(0); // <<<<<<---- error at this line <<                      //iterate through all the layers                             pLayers = pMap.get_Layers(null, true);             }             catch (Exception ex)             {                 MessageBox.Show(ex.Message);             }         }              public static void ChangeSource()         {             pLayers.Reset();                  pLayer = pLayers.Next();             while (pLayer != null)             {                 if (pLayer is IFeatureLayer)                 {                     ChangeLayerDataSource((IFeatureLayer)pLayer);                 }                      pLayer = pLayers.Next();                  }         }


set map center in leaflet with 3857 lat/lon

I'm trying to set map center with lat/lon of 3857 projection in leaflet. By using lat/lon of projection 4326 its working fine.               var map = L.map('map', {             crs: L.CRS.EPSG3857         }).setView([51.40457186188496, -2.3741738081973844], 13);      But it dose not working if i provide 3857 lat/lon.               var map = L.map('map', {                 crs: L.CRS.EPSG3857             }).setView([6693172.2381477, -264291.81938326], 13);      Please help me where i am wrong. Thanks


How to refresh the ArcMap display using ArcPy?

Was trying to replicate a RePast Agent Analyst simulation using just Python and arcpy. The script was about urban expansion. The script just changes the values of a column in a shape file. ArcMap's symbology just color codes the parcels in the map based on the values of the mentioned column. The script just needs a way to refresh/reload the display for every step ( when the values in the column are changed ) of the simulation to show the user the changes. I tried arcpy's RefreshActiveView but it doesn't work. Is there a way to to do it using arcpy? Or do I have to use ArcObjects for this? Thanks in advance.


Failure in removing a layer in OpenLayers

I'm adding some layers on a base map using OpenLayers. The aim is to create a layer with some features in it and later when user changes his prefered query, some other features need to be shown, so its the same layer but with different features. Therefore, I need to remove the layer and create it again with new features and then show it on the map. I'm using the following code for defining and adding the layer:               var Selected_Buildings;     Selected_Buildings = new OpenLayers.Layer.Vector("MyLayer",  { eventListeners:{                 'featureselected':function(evt){             //some actions here                 },                  'featureunselected':function(evt){     //some other actions here                 }},             strategies: [new OpenLayers.Strategy.Fixed()],                 protocol: new OpenLayers.Protocol.HTTP({                     url: "url to php code that runs query and return geo-data in kml format",                     format: new OpenLayers.Format.KML({                         extractStyles: false,                         extractAttributes: true,                         maxDepth: 2})                 }),                     styleMap: new OpenLayers.StyleMap({                         "default": new OpenLayers.Style(OpenLayers.Util.applyDefaults({                            strokeWidth: 2,                          strokeColor: "Gold",                          fillColor: "Gray"                         }, OpenLayers.Feature.Vector.style["default"])),                         "select": new OpenLayers.Style({                          fillColor: "Blue"                         })                     })                 });      And the code for defining SelectControl:               var selectControl;     selectControl = new OpenLayers.Control.SelectFeature(                     [Selected_Buildings],                     {                         clickout: true, toggle: false,                         multiple: false, hover: false                     }                 );                     map.addControl(selectControl);                     selectControl.activate();      and then when user clicks on a button, I try the following code for removing my layer and then again the above code is executed to add new layer:               var mLayers = map.layers;     var remLayers = [];          for (var i=0; i<mLayers.length; i++) {         if (mLayers[i].name == "MyLayer") {             remLayers.push(mLayers[i]);         }     }          for (var i2=0; i2<remLayers.length; i2++) {         map.removeLayer(remLayers[i2]);     }          map.removeControl(selectControl);      I receive no error, but also the layer is not removed from the base map. Any suggestion how to solve this problem? In the above code _MyLayer_ is the name of layer I would like to remove. _selectControl_ is the name of the map control that was created before for the map. Any help would be highly appreciated.


Color-code a Leaflet polyline based on additional values, e.g. altitude, speed,

I'd like to draw a GPX-track on a Leaflet map. The polyline shouldn't have only one color, but I'd like to show certain values like altitude, speed, heart-rate, temperature, cadence, slope color-coded. Of course only one value can be visualized at once. The values would be stored together with `L.LatLng`, e.g. in a `meta: {ele: 298, hr: 155}` object. I'm new to Leaflet and especially concerned about finding an efficient way to do this. The first which came to mind was to create hundreds or thousands of polylines each with a special color. But this sounds very greedy regarding memory and cpu. Any ideas? An example what I mean can be viewed here![MyTourbook screenshot](http://i.stack.imgur.com/MHnP5.png)


Suggest an algorithm to measure how a node is connected to road network

I try to measure how well a node is connected to the rest of the network. If a city has a distant suburb connected with one sole road, it's connectedness is, say 1. If it's connected by 2 roads, it's 2, and so on. A point in the middle of the city is connected infinitely. What are plugins or algorithms available? I personally prefer open source solutions (QGIS, PostGIS, or python-based), but other options are also welcome.


R: How can I create a polygon from several polygons and a line?

I have some spatial objects that I want to combine, namely three polygons and a line. The ultimate goal is to create a polygon that I can overlay on an area of a map of administrative divisions of the UK to highlight a certain zone. If it were a case of combining four polygons, I would have a number of options, but as one of the objects is a line I'm at a bit of a loss as to how to tackle it. I would have thought combining polygons and lines would be a common operation but it seems not. Here's the map produced by my code (see below). ![overview](http://i.stack.imgur.com/MW4u0.png) The red line starts and ends on the coastline or, strictly speaking, on the bank of a river leading to an estuary at the south end, as can be seen in the following images. ![north end](http://i.stack.imgur.com/XJw8M.png) ![south end](http://i.stack.imgur.com/sHZVc.png) So, because there is an intersection I assume it is possible to group the elements together, I just don't know now. To summarise... ![summary](http://i.stack.imgur.com/dOTtr.png) Code follows:               library(httr)     library(ggplot2)     library(scales)          response <- GET(url="https://dl.dropbox.com/u/4115850/spobjects.rda")     load(rawConnection(response$content))          class(dist.shape) # map with administrative divisions     class(terr.shape) # line defining the landward side of the zone     head(dist.df) # data frames created using fortify() function     head(terr.df) # ditto          ggplot(data = dist.df, aes(x = long, y = lat, group = group)) +          geom_polygon(colour = "grey50", fill = "grey80", size = 0.5) +          geom_path(data = terr.df, aes(x = long, y = lat, group = group),                    colour = "red", size = 0.5) +          theme()


ArcGIS 10.1 ERROR 000824: The tool is not licensed in arcpy

I try to run the Zonal Statistic as a Table through arcpy and it gives me: ERROR 000824: The tool is not licensed. Here is the doc for the function: http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000w8000000 I have tried including the line where it checks for my spatial analyst extension:               arcpy.CheckOutExtension("Spatial")      but that just leaves the script running for a long time, way longer than it should (10 minutes+ on a 250Mb raster!) I was hoping anyone else has a workaround/fix? _Thank you for your time!_ **Yes, I have installed Service Pack 1. And Yup, I have checked and enabled all the extensions. Furthermore, I have the advanced ArcInfo version.**


arcpy adding time to Raster Mosiac Footprint

I am trying to create a raster mosiac for use in animating data over time. The current workflow is:   * Create .gdb (arcpy.CreateFileGDB_management)   * Create Raster Mosaic (arcpy.CreateMosaicDataset_management)   * Add rasters to mosaic (arcpy.AddRastersToMosaicDataset_management) The above are all working well. Next I created a new "date" field in the Footprint feature class. What I would like is to do now is for each row in the Footprint table to add a time into the date field. However I seem to be unable to do this. I assume it is because the Footprint layer is treated different than a normal feature class? Do I need to use a footprint specific command (arcpy.BuildFootprints_management)? Thanks for any help. Edit: fixed typo.


How to show the entire number of records in the attribute table?

How do I show the entire number of records in an attribute table? The number should be around 100k records, but it only loads 2k at a time.


Why is SAGA missing from QGIS install on Debian 7.4 wheezy?

something strange is happening. I've just formatted my computer and I have a new fresh debian 7.4 debian wheezy os. I added the qgis testing repository (just like in the previous os I had) but I cannot find Saga anymore. I am sure that in the old pc I didn't add any repository but I was able to use Saga as standalone and through Processing in QGIS. I am also sure that I didn't compiled Saga and I didn't installed as a .deb package. Am I missing something or should I do something? Thanks


Fill holes with an area bigger of a specific value in a raster coverage

I want to fill some areas of a raster coverage with a value of my choice. Those areas now contain NODATA values. So, they look like _holes_ in my coverage. I know I could use r.clump function of GRASS, but I don't know how to specify the maximum area. Because if a hole is bigger than that area, I don't want to consider it as hole. Is that even possible with GRASS?


Shapefiles for all the individual countries in the world

I'm searching for shapefiles that I can later convert into SVG (with something like kartograph.py). Essentially I'm just looking for the outline with (if possible) a dot where the capital is on the map. Is there anywhere that I can download them all? Or is there a better solution than using shapefiles?


How to use Threads in PyQgis, mainly to keep UI active?

I'm trying to develop a plugin, which does heavy computations and as a result, user interface becomes inactive. I know that I should use threads to keep the UI alive (specifically, I have a progress bar that I want to update), but my experience with threads is very limited. I was wondering if there are any good tutorials, or code snippets with documentation that cover this issue. sample of my code so far (without threads):                   def initGui(self):         # Create action that will start plugin configuration         self.action = QAction(             QIcon(":/plugins/lts/icon.png"),             u"LTS calculator", self.iface.mainWindow())         # connect the action to the run method         self.action.triggered.connect(self.run)              # Add toolbar button and menu item         self.iface.addToolBarIcon(self.action)         self.iface.addPluginToMenu(u"&LTS Calculator", self.action)              # QtCore.QObject.connect(self.dlg.ui.find_cc, QtCore.SIGNAL("clicked()"), self.find_connected_components)              QtCore.QObject.connect(self.dlg.ui.process_Button,QtCore.SIGNAL("clicked()"), self.process)         # QtCore.QObject.connect(self.dlg.ui.layerCombo,QtCore.SIGNAL("currentIndexChanged(int)"), self.update_lts_field)         QtCore.QObject.connect(self.dlg.ui.layerCombo,QtCore.SIGNAL("activated (int)"), self.update_lts_field)         QtCore.QObject.connect(self.dlg.ui.find_cc_Button,QtCore.SIGNAL("clicked()"), self.find_connected_components)                   self.update_ui()         self.layers = self.iface.legendInterface().layers()  # store the layer list          # self.dlg.ui.layerCombo.clear()  # clear the combo          for layer in self.layers:    # foreach layer in legend              self.dlg.ui.layerCombo.addItem( layer.name() )    # add it t                  def process(self):         """ Calculates Stress for the selected layer"""         index = self.dlg.ui.layerCombo.currentIndex()          if index < 0:              # it may occur if there's no layer in the combo/legend              pass         else:              layer = self.dlg.ui.layerCombo.itemData(index)          # layer = QgsVectorLayer(self.fileName, "layer_name", "ogr")         nFeat = layer.featureCount()         layer.startEditing()         ...         street.compute_LTS()             if street.LTS != None :                 i+=1                 j=ceil(i/(nFeat/100))                 self.dlg.ui.progress_bar.setValue(j)                 layer.updateFeature(feature)     # run method that performs all the real work     def run(self):         # show the dialog         self.dlg.show()         self.dlg.ui.progress_bar.setValue(0)         self.dlg.ui.progressBar.setValue(0)         self.dlg.ui.layerCombo.clear()         self.dlg.ui.lts_combo.clear()              layers = QgsMapLayerRegistry.instance().mapLayers().values()         for layer in layers:             if layer.type() == QgsMapLayer.VectorLayer and layer.geometryType() == QGis.Line:                 self.dlg.ui.layerCombo.addItem( layer.name(), layer )               self.update_lts_field()         # Run the dialog event loop         result = self.dlg.exec_()         # See if OK was pressed         if result == 1:             # do something useful (delete the line containing pass and             # substitute with your code)             pass      Thanks


Count of features in a polygon

I have a polyline layer has a unique text field that identifies a path. I have made a union with a separate 1km lattice grid. I am needing a way to get a "count" of the number of uniquely identified paths that fall within each 1km grid spacing. Is there a tool in ArcGIS (of note I have an ArcInfo license) to do this?


QGIS 2.0.1 crashes by starting the app

I have QGIS Dufour for Snow Leopard on a Macbook. It worked good until I tried to install a plugin from Garmin an the program crashed. Since them it crashes every time I try to start it. There is always the same error: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000 Crashed Thread: 0 Dispatch queue: com.apple.main-thread I uninstalled the program and reinsallted it, but it still doesn't work. Is there anyone who can help me? Thank you


Workflow for creating line features between two coordinate pairs in QGIS

**I have a table of stream reaches with xy coordinates for their respective tops and bottoms.** **I'd like to convert the table to a feature, using the xy coordinates as the endpoints of the line.** Any suggestions as to the best workflow for doing this would be fantastic. I've googled, but either my vocabulary is off or this isn't a task that's given others much trouble. Thanks


More presentable style class range values, faster

This is as much feature suggestion as it is question: Is there a better way to generate attractive/presentable style class ranges? Currently I have 5 similar datasets. Lets say the values for the first range from 0 to 35.39839437 and the other four from 0 to between 10 and 20, again with long trains of decimals after them. I want to output all 5 on the same colour & number scale with one legend, so lets say 36 classes of size 1, i.e. 0-1, 1-2, ... 34-35,35-36. For equal interval breaks (the closest option) QGis will divide the range (0-35.39etc) by the number of classes so that the bins are e.g 0-0.9992, 0.9992-1.9891, ..., 34.4010-35.39etc. Presentationally this looks crap, and so one has to go through every bin manually changing the values, which takes ages (not helped by lack of keyboard assistance e.g. tabbing, autoselect all next field). And THEN manually changing all the labels to match (SURELY there could be a tick box called "match labels to values"?) If one goes through this lengthy process, at least one can paste this format to the other 4 maps right? No, not easily in any case: one can hack the QML file to align it to the next layer's name, as per Underdark's tip here. Does anyone have any smart tips or clever workarounds for this kind of thing? Or should I raise this overall issue to the devs on hub.qgis? It feels to me that this is an oddly rough edge on what I assume most of us use as a core feature daily?


Spatial Indexes on OS MasterMap Data

What are the optimal settings for setting up a SQL Server 2008 Spatial database with full UK OS MasterMap data in?   * Seperate tables for the different feature types, or a single table with everything in it?   * What spatial index settings have you found work best? Any "best practice" or experience gained would be appreciated. For reference, I'm using Cadcorp to display the data.


After two buffers operations (+/-), why is the result file bigger than the original?

First file ( .shp ) had 1000KB, after 2buffers ( buffers on polygon, 1st buffer +100, 2nd buffer -100 ( small things near polygon should be removed )) in quantum gis file grown to 1500KB, and after the same 2 buffers in postgis file has 20000KB. Anyone can tell me why?


How can I merge the attribute tables from feature classes into a single table, easily?

I have a large number (approx. 1,100) polygon feature classes. What I would like to do is to merge the attribute tables from each of these feature classes into a single **table** , in the simplest and fastest way possible. This will be the first step in a script or model that then uses that table with all polygon values from all layers to perform some tabular joins and selections. Each time I run this script, I will want to re-do the table merge, as the underlying polygon feature classes may change. If it's possible to write the merged table into memory, for speed, that would be best. I'm using ArcGIS 10.1. I think I can do this easily enough in VBA/VB.net, but it might be simplest to set it up as a ModelBuilder model, so that it's easy to share with colleagues.


Simplifying polygons made from binary rasters

I'm using MaxEnt to produce a species presence / absence raster layer. It works fine but I have to choose a cut off point for what constitutes presence or absence. As a result I end up with a lot of single cell polygons. Using the "simplify polygons" check box in the raster to polygon tool helps a little but I still have a lot of single cell polygons (that come as triangles left). I've tried using the exclude and dissolve tools but they seem to leave the outlines there. Really I want to change all polygons under a certain area from 0 (absence) to 1 (presence) and then dissolve those boundaries and finally smooth out the boundaries of the polygons I have left. Any help appreciated.


Pulling CSV file directly from website into QGIS?

I want to be able to automatically update my csv files in a QGIS project. My organization has an online database that can easily export csv files. These csv files are constantly updated with new information. I want to be able to link my QGIS project layers directly to the updated csv files so I do not have to constantly be uploading and rejoining layers to have current maps. Is there an easy way to link the csv file? I am fairly new to QGIS.


How to get a list of adjacent lots to a road in ArcMAP and PostGIS/QGIS?

In the following map, I have:   * A line / road layer   * A parcel / lot layer The Task:   * Find and count the list of lots adjacent to the road with their types (parcel_type is a field in the parcel layer)   * The data is both stored as shp files and as a postgis tables The Issues:   * The line layer and the lot layer do not intersect i.e. the lot layer has the right of way specified in it of the actual width of the road; whereas, the road layer is just a line layer.    * a parcel might be adjacent to a road on more than one location. think of it as a large lot, with a lot within it. or lots with double frontages. (there is an example of such a lot in the picture below   * This has to be automated on all roads of the study area (roughly 20,000 segments) **Image Sample** ![alt text](http://97.107.136.148/sample_map.jpg)


Is there a Raster2pgsql GUI?

Has anyone ever attempted to create a raster2pgsql gui (like the shp2pgsql gui). As I am sometimes lazy to use command line, this could be a very nice to have.


How can I get ArcGIS Server to give a GML GetFeatureInfo response?

Although I have read the following document (http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005300000228000000) I am still totally unsure about how to enable a gml GetFeatureInfo response from ArcGIS Server 10.0 . Is this something on the client-side that needs to be implemented or something in my GetCapabilities Document?


Run ArcGIS 10.1 application on 10.2

I support a .NET application that has been compiled on a PC with ArcGIS 10.1 installed. The application comprises a user interface and an ArcGIS desktop extension, plus an installer assembly that is called by Windows Installer to register the desktop extension during installation. The problem I have is that the application won't run on a PC with ArcGIS 10.2 because the 10.1 ESRI assemblies are not found so it crashes. It seems that since v9.3 ESRI no longer supply publisher policy files any more to redirect the program at runtime to the latest versions. I have managed to redirect the program to load the 10.2 assemblies by adding runtime assembly binding into the application's .exe.config. However, this doesn't redirect the desktop extension and won't solve the problem with the installer looking for the 10.1 libraries when installing the application. ESRI's solution seems to be to re-compile the application every time a new version of ArcGIS is released. However, this means I would need to have a copy of every release of ArcGIS that the end users are using. And I'd have to uninstall and re-install different versions every time I need to change the application code in order to re-compile it. Does anyone have any suggestions? Can the libraries be loaded dynamically at runtime to avoid looking for a specific version? Is there any other solution?


Volume calculation analysis with Quick Terrain Modeler 8.0.2. (QTM)

I have been unsuccessful in finding a tutorial, guide or example of the 'Volume Calculation' analysis tool in Quick Terrain Modeler. http://appliedimagery.com/ I was wondering if anyone else has any success stories they would wish to share and/or how (in)/accurate they have found it to be when comparing (for example) a building while empty versus a building while occupied. How accurate were the measurement(s) between an empty structure and one that is filled, and how long does the calculation generally take (obviously it depends on the size though)? Unfortunately, I'm currently having issues with my LiDAR datasets, so I have yet to test it out myself, nor do I currently have a 'bare' dataset in which to reference to one that is occupied/filled. Is anyone aware of better (or free) software that also does volume calculation analysis? I'm using Quick Terrain Modeler v8.0.2. (x64) Build 80777.


Setting up an application in QT Creator that uses QGIS API

I am a 15 year veteran of Java making my first entry in to C++ applications. I have a specific need to develop a desktop application that produces graphics type output as well as displaying imbedded maps. It looks like Qt and QGIS API are exactly what I need to get this going. I have been playing around with Qt Creator and generated several of the tutorials without too much problems. Now I am trying my first Qt project that incorporates the QGIS api. I am really stuck. I can't figure out where the libraries are that contains the QGIS modules. I think I have an idea how to configure the Qt project if I could find QGIS. I found all the .h files but some of what I need just aren't there. There are some good examples of code that shows how to code with QGIS classes. But I can't find anything that explains how to set the project up. Could someone please help guide me through setting up a project in Qt Creator that will allow me to incorporate the QGIS modules? I have been searching everywhere. Google can be a strange beast. Sometimes you find what you need on the first search. Other times it just never happens. Thanks!


Natural Earth: How to get the position of each country?

I've just split the 1:10m Natural Earth countries into individual JSON files which I plan to render and partially stitch back together using RaphaelJS. The 1:10m map is very big (10mb or so) so loading it all in one go in the browser is not really feasible. But how do I get the position of each country? Opening the 1:10m map in ArcMap's Attribute Table shows no signs of any latitude, longitude, X or Y or whatever. Maybe this info needs to be extracted from an exported JSON of the full map using some JS virtual canvas / positioning system? I.e. for each of the individual countries that need to be stitched together, some server-side script would query the full JSON to get their paths? Thanks!


Is there a website that will let me see add markers and bounding boxes on top of a street map?

Is there a website out there that will let me markers (lat/lon) and bounding boxes (minimum / maximum lat/lon) and let me see it overlayed on top of Google Maps (or OSM, or Bing, etc)? I'm not really looking to create my own webpage for this... I'm hoping someone's implemented something like this for a general use case or a demo and it's online somewhere.


How to manipulate OpenStreetMap schema to be useful in ArcGIS applications?

I have a shapefile of OSM data. I plan to use the data for an ArcEngine application, and I was wondering if there are any existing solutions to getting the data's schema into your typical GIS format. What I'm talking about is the "tags" attribute. It contains a comma-separated list of categories and their values, whereas typically you would see these values as separate fields in a feature class. **Are there any tools available that separate the tag values out into separate fields?** It would probably be straightforward to create a Python script that separates these out, but I'd like to know if a solution already exists before I create one myself.


Improve performances on distance coverage routing - PostgreSQL

I have to create layers of land coverage from one point to anywhere around on a given street network for a given distance (ex: FROM house, DISTANCE 30000m) An important factor to understand; I need the result to be exactly superposed over my network, and the coverage to represent only the parts of the road (let say, the addresses) that can be reached from the network for the given distance. Nothing more. I need to be precise, because it will be used for emergency services and efficiency analysis over the covered network. And to add to the fun, the tool must not only give the right answer, but do it in a decent length of time, as it will ultimately be open to other uses on a public web interface (so no, I don't only need an application that will generate the right routing over a night of work!) The point is not to find the shortest way to get to a known point, so basic pgrouting tools can't get me a direct answer. I developped a working algorithm, and it works well on long routes, but as soon a I enter a "real" network (as for a city, or even a village), it crashes... well, it simply run for hours. Basically, my algorithm goes like this: First, we link our network table to our previous results to make sure we don't take a route that as been looked uppon, unless we have more "remaining distance" to cover at this point, which mean that our new route is better. > FOR a in EXECUTE 'SELECT aa.ogc_fid, aa.'||col_contr||' as cost, > aa.the_geom, aa.source, aa.target > >> >>        FROM '||table_name||' aa LEFT JOIN temp res ON res.ogc_fid = aa.ogc_fid AND res.dist > '||distance||' >>   >> >>> >>>         WHERE (aa.source = '||debut||' >>>                 OR aa.target = '||debut||') >>>                 AND (ARRAY[aa.ogc_fid] && ARRAY['||array_to_string(fromSegment,',')||']) = false >>>                 AND res.ogc_fid is null' >>>   >>> >>> LOOP After that (I'll short the code), IF(distance > a.cost) THEN We insert the informations in the result table, and launch back the function from this node, which developps a tree. ELSE (we don't have enough "remaining distance" to cover the line) We return a st_line_substring of the lenght we can cover, and the function stops So it's a reccursive function that tries to cover every possible routes from the startpoint to the given distance... Any idea about how to improve it's speed? I think the answer would be to modify the fist FOR statement... but after hours of brain boiling, I have to admit that I can't do it alone! Thanks **Some new details** ![Beautiful network](http://i.stack.imgur.com/PAMYb.jpg) Suppose this fictive (and horrible, sorry, not on my computer) network, with the blue point as a startpoint for a given distance. ![As wonderful, but with colors!](http://i.stack.imgur.com/ysIkV.jpg) Driving_distance would give a result such as this (red dots being end vertex for the distance, and green ones intermediate vertex on the path). The problem I face here (but still, not on my computer, can't try it tonight, maybe I'm wrong) is that I need a very precise and stuck-on-the-network polyline result. With these dots, I guess I could recreate the path, using some kind of point_to_line function, but it would not work for complexe polylines that are not straight from startpoint to endpoint (like, if the road makes an "S"...). Same problem with isocrone: ![In red dress?](http://i.stack.imgur.com/A6nUF.jpg) The coverage here is not what I need, simply because it covers spaces that cannot be reached on the real network (like the segment in the pink ellipse, which is pass the terminal red dot). (Sorry about the pictures, I'll probably give you some real screenshots of the problem tomorrow)


What is the origin of the Degrees, Decimal Minutes format?

In my experience, for most non-GIS folks, the most commonly used and understood coordinate system is good old Latitude and Longitude, displayed as degrees, minutes, and seconds (DDMMSS.ss). In GIS, it's of course much easier to use decimal degrees (DD.dd), and with the growth of everyday GIS apps like Google Maps, the non-GIS user is much more familiar with decimal degrees these days than they were 10 years ago. But every now and again, someone brings me a set of coordinates in degrees and decimal minutes. This seems like the worst of both worlds: it can't be used in GIS without a little work, and the format is not immediately obvious to most non-GIS people (many think that it's DDMMSS at first). So why does it exist when we already have decimal degrees, which is easily understood by computers, and degrees-minutes-seconds, which is easily understood by humans?


An unhandled exception of type System.AccessViolationException

I am trying to upgrade a desktop extension from ArcGIS 10.0 to ArcGIS 10.2. I am getting this error:               An unhandled exception of type 'System.AccessViolationException' occurred in GIS.Metadata.dll.       Not sure what may be causing this. My Environment: VS2013, ArcGIS 10.2, VB.NET, Windows 7 (64 bit). I have also added code where it’s failing. Appreciate any feedback.               pGxCatalog = New ESRI.ArcGIS.Catalog.GxCatalog     '// connect to root ...      pGxCatalog.ConnectFolder(IO.Path.GetPathRoot(pPath))          '// connect to folder via Location property     pGxCatalog.Location = IO.Path.GetDirectoryName(pPath) '       **Fails here**               pCatObject = pGxCatalog.GetObjectFromFullName(pPath, numFound)       IF I set the location manually (say C:) it errors on the this line.


Geographic constraints on tables in MapInfo

In MapInfo, how can I remove polygons from a table according to whether or not points from another table fall within their boundaries?


in seach of gps tracking (web) service to use with rails web app

hey out there GISers, i am looking for a gps tracking service i can hook gps devices into and request their infos via a ruby on rails webapp. does anybody know some? any help is appreciated! thanks, martin a site which does similar things is eg.: www.cabulous.com


How to find the country in which a point is located?

I have a PostGis database created with osm2pgsql. I am looking for a way to add the country name in which a point is located to the point row. It must work also for countries with enclaves, such as France (Llívia). In this case, osm2pgsql creates several polygons from the border relation: a polygon with the outer border and and the enclave, and for each of the both countries a polygon with the enclave only. A simple ST_Within or ST_Contains does not work in this case. I found I way to do the job:               update planet_osm_point p set country=            (SELECT distinct poly.name               from planet_osm_point point inner join planet_osm_polygon poly               on (st_within(point.way, poly.way)                  and (st_nrings(poly.way)=1 or not st_within(point.way, st_makepolygon(ST_InteriorRingN(poly.way,1))))                 and not exists (select * from planet_osm_polygon other                                    where other.admin_level='2'                                          and other.name=poly.name                                          and st_contains(st_makepolygon(st_exteriorring(other.way)), poly.way)                                         and other.way_area>poly.way_area))                 where  poly.boundary='administrative' and poly.admin_level='2' and point.osm_id=p.osm_id)            where p.name is not null;      This seems a bit complex to me and takes a lot of processing time. Is there any simpler and faster way to do this?


Incorrectly Projected PostGIS data in TileMill

When I bring `PostGIS` data in `EPSG:900913` into `TileMill`, my layers end up on other continents. This is my workflow: (1) Save `shapefiles` in `QGIS` to `EPSG:900913` (2) Import the `shapefiles` using `PostGIS Shapefile and DBF loader 2.0` in `pgadminIII` ... specify SRID as `900913` in the loader (3) Add `PostGIS` layer in `TileMill`... specify SRS as `900913`. I get this result: https://www.dropbox.com/s/ztw2c03o9r7gv30/tileMill_projection.png Some notes: I have no problems loading the `PostGIS` data into `QGIS` afterwards in the same projection (on-the-fly disabled). I have tried the same process using WGS84 `EPSG:4326` & WGS84 / Pseudo Mercator `EPSG:3857` with no luck. My guesses are that either (1) the `Extent` parameters when Adding PostGIS Layer in `TileMill` have something to do with this (2) TileMill is not reading my PostGIS spatial_ref_sys table correctly. Any thoughts and/or suggestions? I'm going to try inserting a new spatial_ref_sys table like here. Thanks again!


Nearest Neighbor Focal Statistics and Map Algebra

I would like to use a nearest-neighbor type analysis to iterate over a raster. The nearest neighbor analysis will give a cell value of 1 IF AND ONLY IF the cell being analyzed has a cell value larger than all adjacent cells, and 0 otherwise. Is this type of analysis possible with Arcobjects or with the raster calculator tool using map algebra?


Creating spatial tables with PostGIS

In the PostGIS documentation it says that there are two steps to creating a spatial table with SQL: >   1. Create a normal non-spatial table. >   2. Add a spatial column to the table using the OpenGIS "AddGeometryColumn" > function. > If I followed the examples, I would create a table called `terrain_points` like this:               CREATE TABLE terrain_points (        ogc_fid serial NOT NULL,        elevation double precision,     );          SELECT AddGeometryColumn('terrain_points', 'wkb_geometry', 3725, 'POINT', 3 );      Alternatively, if I look at existing tables in **pgAdmin III** , it seems like I could create the same table like this:               CREATE TABLE terrain_points     (       ogc_fid serial NOT NULL,       wkb_geometry geometry,       elevation double precision,       CONSTRAINT terrain_points_pk PRIMARY KEY (ogc_fid),       CONSTRAINT enforce_dims_wkb_geometry CHECK (st_ndims(wkb_geometry) = 3),       CONSTRAINT enforce_geotype_wkb_geometry CHECK (geometrytype(wkb_geometry) = 'POINT'::text OR wkb_geometry IS NULL),       CONSTRAINT enforce_srid_wkb_geometry CHECK (st_srid(wkb_geometry) = 3725)     )     WITH (       OIDS=FALSE     );     ALTER TABLE terrain_points OWNER TO postgres;          -- Index: terrain_points_geom_idx          -- DROP INDEX terrain_points_geom_idx;          CREATE INDEX terrain_points_geom_idx       ON terrain_points       USING gist       (wkb_geometry);      Do these two methods produce the same result? Is the version based on **pgAdmin III** simply more verbose, and doing things that `AddGeometryColumn` would do by default? Thanks.


Error adding buffer to polyline in ArcMap 10

As the next step to what I did in this previous question, I would like to add a buffer to a polyline, with 5 meters on either side. I tried adding buffer to two versions of the line, one in geographic WGS 1984, and the other in projected UTM 16N, but in either case I get the error "spatial reference does not match data frame". Does ArcGIS have specific requirements as to whether I need to have the project/data frame in geographical vs. projected coordinate system? And how do I alleviate this problem? Thanks. P.S. I am running ArcMap 10 in Windows.


Basic Field Calculator Python Question

I'm trying to used the Python syntax in ArcGIS 10's field calculator and am thoroughly confused. So far the most basic calculations are failing me, and I don't understand why. I'm trying to create a function to just set the values of all cells in a column to be a multiple of the argument that I pass in ( I wanted to try something simple to test it out, as anything more complicated I tried also failed). ![enter image description here](http://i.stack.imgur.com/cFiCc.png) However, the error messages are telling me that my syntax is incorrect: ![enter image description here](http://i.stack.imgur.com/HYYA3.png) but I can't understand what is incorrect. * * * As an aside, I'm also horrified at how hard it is to write readable python in the field calculator box as there is no syntax highlighting, or clear indentation. It would be quicker, and easier to write an external Python script to do this calculation, but I want to try to figure out how this new function worked within the program.


Google Earth portable solution and imagery data

I wish to clarify with users who are using Google Earth portable solution. As per portable solution link http://www.google.com/enterprise/earthmaps/portable.html, we can create part of globe and create offline map to use it. However FAQ section in : http://www.google.com/enterprise/earthmaps/earth_enterprise_faq.html mentioned as below: Does the Google Earth Portable solution allow you to use Google's imagery? No, the Google Earth Enterprise portable solution is intended to be used in situations where your employees need to access your internal imagery and mapping data. Google does not provide customers with Google licensed data for portable use. Google has many partners that provide custom Google Earth Enterprise portable solutions with high resolution imagery. Then i am not sure how to use portable solution in offline without Google's imagery data. Any experiences or details on this solution are welcome. Thanks


Is there Open Source equivalent to ArcGIS Integrate (for topology correction)?

I need to transform a set of polygons so that it forms an exact spatial partition/tesselation (no gap - no overlap). What are the existing open-source solutions (software or library) to perform this correction? Ideally, I am looking for open-source versions of the ArcGIS integrate. > Integrate is used to maintain the integrity of shared feature boundaries by > making features coincident if they fall within the specified x,y tolerance. > Features that fall within the specified x,y tolerance are considered > identical or coincident.


Looking for mobile web app map control that can handle layer redraw with good performance

I want to develop mobile web app to track GPS coords in real time (refresh every 10 seconds) from geoserver. Currently I have desktop site I wrote in ExtJS 4 and it works pretty well (Openlayers + GeoJson from WFS) - the layer redraws are not noticable and it gives a feeling that the points are moving (because there are no flickering when layer redraw). I've tried doing the same using sencha touch 2 (found leaflet and openlayers plugins on github) . here what I achieved :   1. Tried google map v3 api - the map renders fast but when drawing the geojson layer or kml layer , in order to update i need to delete the previous features and redraw which cause all the markers to flicker.   2. Openlayers - The map renders very slow when panning / zooming.   3. Leaflet - Also , the map renders very slow (and sometimes idle...) when trying to pan fast or zoom multiple times. so , now I'm stuck with nice UI but poor performance map control (or maybe I don't use the google api correct) This is how I implemented it using google api:               var gMap = Ext.getCmp('map').getMap();     georssLayer.setMap(null);     georssLayer = new google.maps.KmlLayer({        url: 'http://apps.utilis.co.il/geoserver2/wms/reflect?layers=ClearcutCB:DeviceInfo& format=rss&rnd=' + Math.random()});     georssLayer.setMap(gMap);      Will be more than happy having your advise on this one.


How to create a many to one spatial join?

I have a polygon feature class of territories and a point feature class of trees. The points have many attributes, one of them is the tree species name. I need to get the list of all the tree species present within each polygons. I am trying to perform a many to one spatial join (many points to one polygon), but I am unable to make it run successfully. Ideally, I would have as ouput the same polygon layer, with all the attributes of the trees (including names) attached to it. Any ideas ?


Clip Spatial object to bounding box in R

Given a Spatial object in R, how do I clip all of its elements to lie within a bounding box? There are two things I'd like to do (ideally I'd know how to do both, but either is an acceptable solution to my current problem--restricting a polygon shapefile to the continental U.S.).   1. **Drop each element not fully within the bounding box.** This seems like `bbox()<-` would be the logical way, but no such method exists.   2. **Do a true clip operation, such that non-infinitesimal elements (e.g. polygons, lines) are cut off at the boundary**. `sp::bbox` lacks an assignment method, so the only way I've come up with would be to use `over` or `gContains`/`gCrosses` in conjunction with a SpatialPolygons object containing a box with the new bounding box's coordinates. Then when clipping a polygon object, you'd have to figure out which are contained vs. cross, and alter the coordinates of those polygons so that they don't exceed the box. Or something like `gIntersection`. But surely there's a simpler way? While I know that there are many problems with bounding boxes, and that a spatial overlay to a polygon that defines the region of interest is typically preferable, in many situations, bounding boxes work fine and are simpler.


Tool to search for repeated codes in ArcGIS 10.1

I am using ArcGIS 10.1. I have a shapefile that has a field called "Code". I want to make a Modelbuilder model to check if there are "duplicate" codes. Is there a tool that could do this?