Shortest path for a given waypoints

I have an application where the user selects some "markers" from a google maps (all those coordinates' markers are stored into a postgresql database). Right now, I can draw the route between all selected markers (using DirectionService) but when I have over 10 waypoints the route seems to be drawn in the user selected order (not in the "shortest route" order - I also used optimizeWaypoints param to true and split the route into subroutes of 8 points + start and stop points without success). What I`m trying to do now: when the user selects a marker, I save his selection (marker coordinates) and then all selected coordinates are sent (via ajax) to the server. The received coordinates are in a format something like this: array((lat1,lng1), (lat2,lng2), ...(latn,lngn)) From here, I want to return back to the user all those coordinates ordered by "shortest path" and I dont know how to achieve this. Any idea will be great. Thanks.


RESTful Geoprocessing Service Request returns empty Result object without errors

This is a bit difficult for anyone here to test as our ArcGIS Server 10.2 instance is behind a firewall. I'll try to present all the necessary information, but feel free to ask for more and I'll adjust the question accordingly. I have a Geoprocessing Service hosted on ArcGIS Server. The service is a very simple Python script (below) that takes in a string of Hydrologic Unit Codes (in this case sub-watersheds [HUC8 level]). The script takes this string, splits it and compares against a table of species occurrence by watershed. This data is compiled into a Python dictionary and returned as JSON with the json module. I'm accessing this service via an ajax request from a web mapping app, but for simplicity's sake I'll leave the JavaScript side out unless it's really necessary. **Python**               import arcpy, json          # files     hucs = r'S:\ES\ES 2007 Efiles\PROP-500 Maps and Photography\PROP-540 Geographical Information System (GIS) Data files\MegaPetition.gdb\HUCs'     species = r'S:\ES\ES 2007 Efiles\PROP-500 Maps and Photography\PROP-540 Geographical Information System (GIS) Data files\MegaPetition.gdb\CandidatesHUC'     data = {}     Watersheds = arcpy.GetParameterAsText(0)     Watersheds = Watersheds.split(",")          cursor = arcpy.SearchCursor(hucs)          for row in cursor:         for watershed in Watersheds:             if row.HUC_CODE == watershed:                 currentWatershed = {}                 speciesList = []                 arcpy.AddMessage("Working on " + row.HUC_NAME + "...")                      whereClause = "HUC8_CD = '" + watershed + "'"                 speciesCursor = arcpy.SearchCursor(species, whereClause)                 arcpy.AddMessage("    Contains " + str(row.NumPetitionedSp) + " At-Risk Species.")                      for animal in speciesCursor:                     speciesList.append(animal.GCOMNAME)                 currentWatershed = {'attributes': [watershed, row.NumPetitionedSp],                                     'species': speciesList}                 data[row.HUC_NAME] = currentWatershed          print json.dumps(data)     del row, cursor      Perhaps I don't understand how the script gets the string of watersheds from the request so that I can use it in my script. With a Script Tool I use `arcpy.GetParameterAsText(0)`, but that doesn't seem to apply here. I've tried to execute this script through the ArcGIS Server GP Service Page, but I still get an empty result: ![RESTful Request](http://i.stack.imgur.com/HyBga.png) Generates the following URL: `http://server- address/arcgis/rest/services/NatureServe/AtRiskGPService/GPServer/NatureServe%20At%20Risk%20GP%20Service/execute?Watersheds=06040003%2C06040002%2C06030003%2C06030002%2C06030005&env%3AoutSR=&env%3AprocessSR=&returnZ=false&returnM=false&f=pjson` With the following Response: ![Empty Response](http://i.stack.imgur.com/2H6bl.png) **Update!** I changed the messaging option for the service from _Error_ to _Info_ , so I can see that the script is taking in the watershed parameter and processing it. It looks like it's just not sending the response back as part of the Result object. The Result object is created by running a GP tool (ex. `result = arcpy.GetCount_management(in_table)`). Is there any way I can add my own data to the Result object if I'm not actually running any GP tools? If not I guess I need to send the JSON through a message instead.


How to calculate pixel per meter ration according to zoomlevel in google map(bing map)?

I am new here. I need some help. Right now, I got an image and detect two points in the image. I want to calculate the distance between these two points. I got:   * 1 . x,y pixel value for both two points.    * 2 . zoomlevel 19 or something else   * 3 . Using google map and bing map What I need is just pixel per meters(ratio).


Ontario Topographic and Property Data

Looking for Ontario topographic data and property line data; willing to purchase the latter. Shapefiles or file geodatabase files would be optimal. In terms of topographic data, I am looking for: basic outline of Ontario, county or municipal outlines, contour data, water (lines, poly, etc), buildings, and so forth.


How to create a new column to store the length of a linestring in postgis?

I am working with pgRouting, following this nice guide：A Beginner’s Guide to pgRouting I am now in this step：Calculating shortest routes, with these codes below               SELECT * FROM shortest_path('     SELECT gid AS id,            start_id::int4 AS source,            end_id::int4 AS target,            shape_leng::float8 AS cost     FROM network',     1,     5110,     false,     false);      and my network table looks like this ![enter image description here](http://i.stack.imgur.com/zCjRg.png) apparently I have no column "shape_leng", so I need to create a new column in table network, and it is the length of every row. But I don't know how I should type the ST_length code. Can someone give me some advice？


Help with WPS.client

Hy! I am trying to make an application which will test if any of the segments (multi line layer acquired from GeoServer) intersects with polygon acquired using OpenLayers.Protocol.WFS.fromWMSLayer, and if it does add it to the map. After the polygon has been selected it's added to an empty vector layer which is then used as an input in WPS.Client. The code looks like this:               int = client.getProcess('server', 'JTS:intersection');             for (var i=0; i<v_layer.features.length+1; i++){             int.execute({                      inputs: {                               a: selected.features[0].geometry,                               b: segment_layer.features[i].geometry                              },                      success: function(outputs) {                                                  map.layers[3].addFeatures(outputs.result);                                                 }        });                  }      This works, when I tested it on just a few segments, but since this layer contains about 200 of them it crashes the browser. I couldn't find any other WPS process that i could use other than JTS:intersection. Any suggestions? Thank you for your time.


NVIZ runs from GRASS but not via QGIS

When I try to run NVIZ from QGIS I get an error which states 'Can't find usable init.tcl in the following directories" and then goes on to list a number of directories. (I did have a screenshot here but couldn't post it as a newbie.) However when I try to run NVIZ directly from GRASS it runs properly. I have searched for the init file which the QGIS error report says cannot be found and it is actually in "C:\Program Files (x86)\Quantum GIS Lisboa\lib\tcl8.5". According to the QGIS error report this is not one of the directories actually searched. I do have a workaround running NVIZ from GRASS but that is clearly not as satisfactory as running from within QGIS. I have noted the reply to an earlier question on this topic which recommends installing tcl/tk via OSGEO4W. However I do not believe that these components are actually missing since I've found the init file. Can anyone suggest a solution, please? I am a new user of QGIS and have downloaded 1.8.0 Lisboa, running under Windows 7.


Java shared hosting with PostGIS

I've been developing a disaster risk management application that makes use of Java/Smart GWT, PostgreSQL/PostGIS, and Tomcat 7. I'm looking for a shared hosting environment for the beta testing period (about 6 months). My current hosting provider does not provide PostGIS, or PostgreSQL greater than version 8.1. Any pointers or advice will be appreciated.


Geoserver 2.5.1 Image Mosaic Plugin

I have geoserver 2.5.1 running on ubuntu 14.04 server. I tried to compose an image mosaic with ImageMosaicPlugin but I always get a message **Could not list layers for this store, an error occurred retrieving them: Failed to create reader from file:data/dalekovod and hints nul**. Images are in the right file format because geoserver recognizes them, and I can load each at one of them separately but I have 120 images. Any idea what could be the problem?


Transect with square polygons

would like to create with QGis 2.2 (german version) several square polygons (1km ²) that seamlessly connect to each other, so that a strip ( transect ) of 9km times 1km length results . ( I once attached a picture of how it should look ) -  http://www.myimg.de/?img=TransektArcMap75b51.jpg Although I have installed the plugin " Rectangles ovals digitizing ", but can not choose here the edge length . In addition, the following square is to connect seamlessly . In ArcMap the cursor shows me when digitizing contacts with neighboring polygons or their vertexes or lines on , so you could work " seamlessly " . Furthermore, each of the squares , partially each quadrant , then an attribute (here, an air quality index) to be assigned , in accordance with which the square to be dyed. Are different colors within a shape based on various values (how it works in ArcMap ) possible? About tips on how I can tackle this project , I'd be very happy . PS: For information on tools , etc. ..... I use the German user interface. Best regards and thank you in advance Daniel


Can't start ArcSDE (esri_sde) service

I am getting an error message when atempting to create a connection in ArcCatalog (I'm working under the 10.0 version). The message is : Failed to Connect to the specified server. No ArcSDE server licence found. Then I Check the Service esri_sde and it has not started, so I try to start it then I get this error message : The ArcSde Service(esri_sde) service on Local Computer started and then stopped. Some services stop automatically if they have no work to do. I've tried deleting the service then creating it all over again, checked the registry, launched CCleaner.. Rebooted the computer, still the same error When I check the log files, I got this in the giomgr_esri_sde.log : Sat Jun 14 16:15:23 2014 - ****** Spatial Database I/O Manager ****** Sat Jun 14 16:15:23 2014 - SDE System Startup Initiated . . . Sat Jun 14 16:15:23 2014 - Validated System Paths. Sat Jun 14 16:15:23 2014 - SDE IOMGR going into background . . . Sat Jun 14 16:15:23 2014 - System Parameter table 'SERVER_CONFIG' Read. Sat Jun 14 16:15:24 2014 - Initialized Shared Memory Segment. Sat Jun 14 16:15:24 2014 - Error (-327), No ArcSDE server license found. And in the sde_esri_sde.log : * * * ## ArcSDE 10.0 for PostgreSQL Build 685 Fri May 14 12:05:43 2010 Connected to instance . . . DBMS Connection established... Error (-327), No ArcSDE server license found. I don't understand this licence problem! I have already registered and I do have the licence. What could be wrong ?


Why do TIF loaded into PostGIS lose their colormap?

I have successfully loaded a TIF image (using raster2pgsql) into my PostGIS 2.0.1 database. I can load the raster image into QGIS and it displays in the correct space. However, it has lost all colour and appears as a greyscale image. (Layer Properties > Style > Single band gray, colormap = grayscale) If I load the same image directly from file into QGIS it displays colours correctly.(Layer Properties > Style > Single band gray, colormap = colormap) If I convert the TIF to JPG and load the JPG to PostGIS and then display in QGIS the colours render correctly. (Layer Properties > Style > Three band color) I can save the colourmap from an image and apply it to the greyscale images but the colours aren't quite right. What do I need to do to get the TIF images to retain their colourmap when I load to PostGIS? Windows 7 32-bit PostgreSQL 9.1.4 PostGIS 2.0.1 QGIS 1.8.0 raster2pgsql -s 27700 -I -C -M *.tif -F -t 200x200 gis_rasters.osvmd > vmd.sql Thanks in advance Ross


Merging raster data with different resolutions

I need to merge different raster datasets which have one layer and contain discrete values to a layer stack. The resolutions of the data can have any value so not only multiples of the resolutions from the other input rasters thus there are problems with alignment. Also the corner coordinates are not necessarily identical. Has anybody got a creative idea of what is the best way to do the merging without losing information as a layer stack can only have layers with the same resolution? I have used gdal_merge.py and of course there is quite some loss of information through the nearest neighbour resampling (though I must use nearest neighbour as I want to keep discrete values). One thing I thought of was to polygonize each raster and then union them and rasterize the resuling polygon with a appropriate resolution. That would keep most information but here I am afraid that it will not work properly with large datasets. Perhaps somebody has experience with this? Thanks for any help! Kind Regards DomR


pgrouting crashes and restarts the postgresql server when searching for endpoints in 2 disjoints graphs

I have               >apt-show-versions postgresql-9.1-pgrouting     postgresql-9.1-pgrouting/precise uptodate 2.0.0-release-ppa1~precise2      Whenever I do a search http://docs.pgrouting.org/dev/src/astar/doc/index.html between two end points in disjoint graphs, I get the error error sending I/O to backend and my postgresql server crashes and restarts. Why doesnt this simply return a no route found?


Alternative indexing methods for point set operations

It is common to use a bounding box spatial index to improve performance when working with a large number of features. Where operations are performed against individual geometries with a large number of vertices do any similar optimization strategies exist? For example, do any data structures exist that can speed up point in polygon, or union operations?


How do I extract text from dwg?

I'm trying to convert data from an AUtoCad Civil 3d drawing to a text format to use in ArcGIS. Each dwg has coordinate and text information that I would like to use for point location and attributes. The text looks to be a table but is in fact just mtext and line objects. I have found LISP code that will export all the mtext to a text file but I am wondering if there is a way to place all the text found at the same xy location in the dwg to be placed on one line in the text file? Thanks!


PostGIS: ST_Transform function conversion problem

I'm inserting map data from a GML file with srid EPSG:27700 into a PostGIS database table with srid EPSG:4326. I'm using the ST_Transform function as in this snippet:                ST_Transform(ST_GeomFromGML('<gml:Point srsName="EPSG:27700">         <gml:coordinates>527347.0,181346.0</gml:coordinates></gml:Point>'), 4326);      After the data was inserted in the database I tried to find if its geometry intersects with an existing table's geometry using the ST_Intersects function. The function returned FALSE in all cases, but I knew that the two geometry layers _should_ intersect. So, I loaded the layers in QuantumGIS to see what's happening. The PostGIS layers indeed don't intersect, but when I loaded the GML data directly from the GML file using the original srid (EPSG:27700) the map data correctly appeared on top of the pre-existing layer with srid 4326, with which I knew it should intersect. The problem is that the ST_Intersects function (as well as all the others of the same kind) works only for geometries with the same srid, so I need to solve the transformation issue. Apparently there's either a problem with the ST_Transform function, or I'm missing something that I should know. I use PostGIS 1.5.3. Any help will be greatly appreciated.


Reinventing the wheel: Public Transit System

I'm building a public transit service in South Africa, and I initially started the project on PHP and MySQL. I've managed to get far with the simple stack, with:   * Routing algorithm in PHP   * Data storage as coordinates in MySQL   * front-end in WordPress   * JS for Google Maps and a REST API for mobile apps (incomplete) _My question based on the above is: I want to move away from using PHP in the back-end, and I'd like to know what alternatives there are._ I'm fairly inexperienced, and used PHP as it's the only server-side language that I currently know. I've seen that a lot of map/routing applications use Java and Python, and am thinking of moving in that direction in future. I'm finding myself having to do a lot of geographic calculations, and as my data grows I find myself reinventing the wheel. **Would a PostGIS + PgRouting setup benefit me?** A working demo of the project can be found at http://rwt.to. **UPDATE:** The project has subsequently went live. Thanks for all the suggestions.


How to draw (or add) a line indicating a specific latitude/longitude?

I'm trying to add a single line that show a specific latitude (e.g. the Tropic of Cancer) I don't want a gird but only a single line even in a vector layer.How can I do that I've try with pyQGIS console but seems I can't... I would like to measure angle with that line so I'd like to have it in a layer. However I found useful a method to use it in print composer, but my main goal is to have it as line in QGIS. For the moment I'm using Google Satellite open layers with a EPSG:3857.


Issue on IFeatureDataConverter.ConvertFeatureClass

Does anyone know if it's possible to reuse this method with a "feature dataset" already present ? I'm trying to import multiple shapefiles under a featuredataset inside a fgeodb. Everything it's working fine the first time when I create a new featuredataset but if I try to load a second shapefile inside it I get an error. I know that a work around it's to use the geoprocessor but there are some interesting thinks in dataconverter that I need. Tnx


ArcGIS Server: Better to have one massive map service or multiple smaller services?

I have a Silverlight application that consumes around 30 map service layers at different types. The service layers are categorized based on type and only applicable to certain screens of the application. For organization's sake, I split each of the layer categories into separate map services, but I'm considering whether or not that makes sense. What is the best practice in this situation? Should I just lump all of the map layers into a massive map service or keep them separate? I'm curious about server load vs application performance.


CORINE LandCover: what about the accuracy?

How accurate is CLC? Do anyone know any scientific papers about that question? I tested the new CLC2006 for a region in turkey and its totally rubbish!


Using web mapping and geocoding to track genealogical data

Over the last year I have gotten involved in researching my family tree. My paternal grandfather came from a remote island in the Atlantic, along with hundreds of others of his generation, and many of them settled within the same area. As the island is very small, they shared a small number of family names (about 30 surnames, with some variations of the same name). I would really like to use my GIS knowledge to firstly gather data on where the descendents are living now (the recently established Society has compiled a small database), and then to analyse the data to map out the various family names/bloodlines/races (the islanders are a melting pot of races, absolutely fantastic). Before I offer my services to the Society, I'd like to know if anyone has undertaken something similar, and what would be the best way to approach it? As mentioned in the question title, I want to use ArcGIS Online so that others will be able to add their info and I would manage the data. Some light googling indicates that geocoding surnames might be part of what I am looking for, but as I have no experience with it I'm not sure.


Loading a multipoint shapefile in R

This issue has only been raised in the community once, two years ago, to the best of my knowledge. I think it's high time to raise the issue again! `readOGR`, from the rgdal package, cannot handle multipoint shapefiles, even though they load fine in other GIS packages like QGIS. Of course, you can save the file as a single part object (see image below) in an external program, but ideally it would also be possible to do it in R. Please see worked example below. ![multipart shp file in qgis](http://i.stack.imgur.com/UPRoR.png)               download.file("http://www.personal.leeds.ac.uk/~georl/egs/lnd-stations-multi.zip",                    "lnd-stations.zip") # download multi part polygon     unzip("lnd-stations.zip") # unzip     lndS <- readOGR(".", "lnd-stations", p4s = "+init=epsg:27700") # load          OGR data source with driver: ESRI Shapefile      Source: ".", layer: "lnd-stations"     with 2532 features and 27 fields     Feature type: wkbMultiPoint with 2 dimensions     Error in readOGR(".", "lnd-stations", p4s = "+init=epsg:27700") :        Incompatible geometry: 4      After performing "Multipart to singleparts" in the QGIS Vector menu (illustrated above) and saving the file, it loads fine in R. Try it:               download.file("http://www.personal.leeds.ac.uk/~georl/egs/lnd-stns.zip",                    "lnd-stns.zip")     unzip("lnd-stns.zip")     lndS <- readOGR(".", "lnd-stns", p4s = "+init=epsg:27700")     plot(lndS)


PostGIS/QGIS and granting permissions

I've got a PostGIS databases, with lots of schemas. I can easily create a new user that will allow them to update and delete features. However when I get the user to create a new feature I get the following error in QGIS:-                 PostGIS error while adding features: ERROR:  new row for relation "conservation_areas" violates check constraint "enforce_geotype_geom      I've used the following SQL to GRANT the user (anne) privilages that will allow her to update and delete, but I guess its the insert bit that is letting me down.               GRANT ALL ON SCHEMA conservation TO anne;     GRANT SELECT ON ALL TABLES IN SCHEMA conservation TO anne;     GRANT UPDATE ON conservation.conservation_areas_gid_seq To anne;     GRANT UPDATE ON conservation.conservation_areas TO anne;      The postgres user has no such issues when edited data, therefore I'm missing something somewhere when i'm granting the user permissions. Is there a simple SQL that will allow a user to do everything that the Postgres user can do but to a specific tables (and not all tables) within a schema? Med


Best practicies when employing a file geodatabase that is going to be used and edited by multiple users?

I have a file geodatabase that contains 3 feature classes in it and each feature class contains a lot of data that will be viewed and edited daily by 6 other users. I am looking for any advice from people who have been in the same situation and the best practices to avoid edit lock outs and to keep everything running smoothly as possible. Is these any open source tools I can use that will enable multi user editing on a file geodatabase? Thank you! Edit: My work only has ArcView level licencing with a couple extensions (Business Analyst, Network Analyst and Spatial Analyst)


How do I disable the Add Spatial Database Connection function in ArcGis?

Is it possible to remove/disable the Add Spatial Database Connection and Add OLE DB Connection functionality from ArcMap and ArcCatalog? Ideally the end user could hit the Add Data button, and the add connections buttons would not show up in the add data dialog. Any pointers in the right direction are much appreciated.


How to get UK postcodes for coordinates?

I m quite new with the GIS science and would like a bit of help. I m a weather forecaster and doing my MSc degree. I have a list generated with WRF and contains in a txt format the long and lats and solar radiation values. I would like to export this data into a list which will contain the postcodes assigned to the long and lats for England. Could anyone help me on this? Thanks.


How to train a signature file for supervised classification in ArcGIS 9.3

I wanna do supervised classification in ArcGIS 9.3. I have a 321RGB composite of a pretty good quality which I want to use for supervised classification. How can I create signature file which contains training sites, and how do I create training sites? I do know what qualities are needed regarding the areas and the number of areas (number, all possible categories, spectrally separable etc.) Thank you in advance.


Does GeoServer and/or MapServer have a services directory similar to ArcGIS's services directory?

Does GeoServer or MapServer have anything analogous to the ArcGIS Server services directory? Is there a convenient endpoint where you can see all the services hosted on a particular machine? Edit: I'm looking for the GeoServer or MapServer equivalent of this: http://sampleserver3.arcgisonline.com/ArcGIS/rest/services


Determine why OpenLayers.Bounds containsLonLat() returns false

In this code, I'm loading a bunch of random points that are roughly in the contiguous USA. I've created a OpenLayers.Bounds object roughly corresponding to that extent. When I select a point, I want to determine whether that point falls within those Bounds. If you load up this code, you'll see that clicking on a point in the USA should cause Bounds#containsLonLat to return true. But alas, no. Why? ![enter image description here](http://i.stack.imgur.com/0YtrS.png)                   var map, osm;         var fromProj = new OpenLayers.Projection("EPSG:4326");         var toProj = new OpenLayers.Projection("EPSG:900913");         var center, pointsLayer, usaBounds;              $(function() {             var vector = new OpenLayers.Layer.Vector('vector');             var boxes  = new OpenLayers.Layer.Vector( "Boxes", { style: {fillColor: '#000', fillOpacity: 0.1, strokeWidth: 0}} );                  map = new OpenLayers.Map("map", {});             osm = new OpenLayers.Layer.OSM();             center = new OpenLayers.LonLat(-98.5795, 39.8282).transform(fromProj, toProj);                  pointsLayer = new OpenLayers.Layer.Vector("Clients", {});             var px, py;             var pointFeatures = [];                  for(var i=0; i< 50; i++) {                 // 50 random points roughly in continental USA                 var latMin = 30; var latMax = 50; var longMin = -120; var longMax = -50;                 py = Math.floor(Math.random() * (latMax - latMin + 1) + latMin);                 px = Math.floor(Math.random() * (longMax - longMin + 1) + longMin);                 var pointGeometry = new OpenLayers.Geometry.Point(px, py).transform(fromProj, toProj);                 var pointFeature = new OpenLayers.Feature.Vector(pointGeometry);                 pointFeatures.push(pointFeature);             }             pointsLayer.addFeatures(pointFeatures);                  usaBounds = new OpenLayers.Bounds(-125, 50, -60, 20);             usaBounds.transform(fromProj, toProj);             var box = new OpenLayers.Feature.Vector(usaBounds.toGeometry());             boxes.addFeatures(box);             map.addLayers([osm,pointsLayer,boxes]);                  var selectControl = new OpenLayers.Control.SelectFeature(pointsLayer, {                 hover: false, clickout: true,                 onSelect: function(feature) {                     thisFeature = feature;                     ll = feature.geometry.getBounds().getCenterLonLat();                     px = map.getPixelFromLonLat(ll);                         // ll.transform(fromProj, toProj);                              console.log(usaBounds.toBBOX());                              var containsLL = usaBounds.containsLonLat(ll);         // >>>>>>>> THIS IS ALWAYS FALSE, BUT SHOULD BE TRUE                         console.log("Contains LonLat: " + containsLL);                              var containsPixel = usaBounds.containsPixel(px);         // >>>>>>>> LIKEWISE, THIS IS ALWAYS FALSE, BUT SHOULD BE TRUE                         console.log("Contains Pixel: " + containsPixel);                     }                 });             map.addControl(selectControl);             selectControl.activate();                  map.setCenter(center,3);              }); // end JQR          </script>


How to I create and Import marker symbols (or 'Style References') in ArcMap 10?

I work with many different federal lands all of which can be associated with iconic logos (think National Park Service, National Wildlife Refuge System, etc.). I'd like to create a 'Style Reference' that has all of the different logos to denote point data. This will be a working style reference as I encounter new features from time to time. Any reference to maintaining or editing a style reference would be helpful. I'm assuming the preferred format would be .emf (vector) to maintain transparency, but I'm not at all familiar with the style format structure or file type. ![National Park Service](http://i.stack.imgur.com/5I5WP.jpg) ![National Wildlife Refuge System](http://i.stack.imgur.com/hPjlc.jpg)


How to extract raster using corresponding polygon using ArcPy?

I have to perform a simple raster extraction, but I can't find the way to do it. In a polygon layer, I have watersheds with their ID's. And in a folder, I have rasters, each one corresponding to a watershed (but larger than it) and with the ID of the corresponding watershed in their filenames. For instance, my watershed polygon with the ID 1 corresponds to raster_1. And I have 119 watershed polygons, so 119 rasters. What I want to do:                  for each watershed in watersheds:             if watershed(ID) in raster(Filename):                   extract raster by polygon using the watershed      Does it make sense ? Thanks for your help


whereClause syntax for Cost Distance parameter

I am looking to create a sql expression regarding point feature class and selection based on 'Name' field to pass to arcpy.sa.CostDistance() param[0]. similat to:               savepath = env.workspace = r'G:\Xcel\Route Tool\Potter\Scratch.gdb'     weighted_Raster = r'G:\Xcel\Route Tool\Potter\Scratch.gdb\weighted_Raster'     fc = r'G:\Xcel\Route Tool\Potter\Data.gdb\Subs_w_dist'     Field = 'Name'     destValue = 'Coulter'     where_clause = createSQL(Field, destValue)               #Calculate the least accumulative cost distance for each cell to the nearest source over a cost surface.     outCostDist = arcpy.sa.CostDistance(where_clause, weighted_Raster,"", 'Output_Backlink')     outCostDist.save('distance_Raster')      How do I use make feature layer using variables as input. Similar to:               savepath = env.workspace = r'G:\Xcel\Route Tool\Potter\Scratch.gdb'     weighted_Raster = r'G:\Xcel\Route Tool\Potter\Scratch.gdb\weighted_Raster'     fc = r'G:\Xcel\Route Tool\Potter\Data.gdb\Subs_w_dist'     Field = 'Name'     destValue = 'Coulter'          destination = arcpy.MakeFeatureLayer_management(fc,'dest_Selection', [Field] = destValue)          #Calculate the least accumulative cost distance for each cell to the nearest source over a cost surface.     outCostDist = arcpy.sa.CostDistance(destination,weighted_Raster,"",'Output_Backlink')     outCostDist.save('distance_Raster')     distance_Raster = "distance_Raster"


Variable stored as NoneType in Python with updateCursor

## SOLVED: although the field was not nullable (no null values), a glitch created one in the heading field, so the variable was stored as a null value and thus the NoneType. I am using updateCursor to subtract a previous value (last direction) from a current value (direction) to populate a new field (change in direction). I borrowed and modified code from the forums (thanks anonymous contributors!) so while I understand the conditionals and what they all do, I did not write this myself. Code:               import arcpy     fc = r'...'     rows = arcpy.UpdateCursor(fc)     firstTime = True     for row in rows:         if firstTime:             previous = row.heading             firstTime = False         else:             row.angle = row.heading - previous             rows.updateRow(row)             previous = row.heading     del row, rows      The error I get is:               Runtime error <type 'exceptions.TypeError'>: unsupported operand type(s) for -: 'int' and 'NoneType'      From what I understand because I have no return function after I define my variable previous, it gets erased and the variable is read as NoneType. However with multiple tries I've figured out that the return command only works in def function() codeblocks.   Is there an equivalent to return for updateCursor? UPDATE: this similar Codeblock produces the same results.               import arcpy     fc = r'...'     rows = arcpy.UpdateCursor(fc)     count = 0     for row in rows:         if count != 0:             count = count + 1             row.angle = row.heading - previous             rows.updateRow(row)             previous = row.heading         else:             count = 1             previous = row.heading     del row, rows


How can I import OS coordinates from excel into QGIS?

I am new to QGIS, but I really like it so far! I have an excel dataset of about 10000 datapoints from Great Britain in this "OSGB 1936 British National Grid" format. Sadly, not all of my coordinates have the same resolution. This means that I have a table full of "NC02", "TR057647",... and so on. Is there an easy way to load this dataset into QGIS?


Using Multiple Web Adaptors ArcGIS-Server 10.2

Currently we have a brand spanking new install of 10.2 ArcGIS-Server with the web adaptor installed on a separate server in the DMZ running HTTPS with a purchase SSL cert. We cannot bind both 80 and 443 on the IIS server as it breaks the applications using the SSL for some reason. We need to install a second on another web server for a 3rd party app that integrates GIS web mapping into its software but cannot do HTTPS, so this will be Web Adaptor #2 using only http 80. Has anyone ever done multiple web adaptors? Are there any caveats to this?


QGIS Map tools and Map canvas--QString errors

I'm trying to learn more about using QGIS Map Canvas widgets and creating custom map tools, so the information from the PyQGIS cookbook is very helpful. After trying to experiment with mywnd.py from this page: https://www.qgis.org/en/docs/pyqgis_developer_cookbook/canvas.html I had a few difficulties. On first try running the script, I got ImportError: cannot import name QString. To overcome this error I imported like so:               try:         from PyQt4.QtCore import SIGNAL, Qt, QString     except ImportError:         QString = str      That allowed me to get through the import. However, after inputting the following lines into the python console as directed by the cookbook, I got NameError: global name 'QString' is not defined               w = mywnd.MyWnd(qgis.utils.iface.activeLayer())      I'm new to all of this, so any help would be appreciated. Mahalo in advance.


Map doesn't show anything in img file (WMS-Mapserver)

Actually in a practical Project we wanted to use OpenLayer and MapServer to display our data using WMS, but   We can't find a proper srs or EPSG code. One of the ITC students said, we have to change our MapServer software! I'm not sure it's an effective solution. I will absolutely delighted that you give me a helping hand. I set the map file but when I used WMS, The map loaded but anything didn't show.   How can one fix it? This is .proj file of a layer:               > PROJCS["WGS_1984_Lambert_Conformal_Conic",       GEOGCS["GCS_WGS_1984",       DATUM["D_WGS_1984",       SPHEROID["WGS_1984",6378137.0,298.257223563]],       PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],       PROJECTION["Lambert_Conformal_Conic"],       PARAMETER["False_Easting",0.0],       PARAMETER["False_Northing",0.0],       PARAMETER["Central_Meridian",54.0],       PARAMETER["Standard_Parallel_1",30.0],       PARAMETER["Standard_Parallel_2",36.0],       PARAMETER["Latitude_Of_Origin",24.0],       UNIT["Meter",1.0]]        Thanks for your comment.   This is my config file!   I don't khnow how can I attch my shp file.               MAP     FONTSET  "fonts/fonts.list"            NAME Iran       IMAGECOLOR 255 255 255       SIZE 600 800        I don't know Which ESPG code I can use!               WEB       IMAGEPATH "/tmp/ms_tmp/"       IMAGEURL "/ms_tmp/"       METADATA         "map" "C:/ms4w/apps/Iran/config.map"         "ows_schemas_location" "http://schemas.opengeospatial.net"         "ows_title" "Sample WMS"         "ows_abstract" "Stations"         "ows_keywordlist" "Stations,WMS,Raymand"         "ows_onlineresource" "--/cgi-bin/mapserv.exe?map=c:/ms4w/apps/Iran/config.map&"         "wms_srs" "EPSG:4326 " #latlon              "wms_feature_info_mime_type" "text/plain"         "wms_feature_info_mime_type" "text/html"         "wms_server_version" "1.1.1"         "wms_formatlist" "image/png,image/gif,image/jpeg"         "wms_format" "image/gif"        END #metadata        END #web            LAYER       NAME allStations       TYPE POINT       STATUS ON       TOLERANCE 8       TOLERANCEUNITS pixels       DATA data/allStations       METADATA         "wms_title" "allStations"         "wms_include_items" "all"       END            END #layer allStations       LAYER       NAME "province"       TYPE POLYGON       STATUS ON       TOLERANCE 8       TOLERANCEUNITS pixels       DATA data/province       METADATA         "ows_title" "province"         "wms_include_items" "all"       END #metadata       END #layer proviance            SCALEBAR       IMAGECOLOR 255 255 255       LABEL        COLOR 0 0 0        SIZE TINY       END            STYLE 1       SIZE 130 2       COLOR 0 0 0       UNITS KILOMETERS       INTERVALS 2       TRANSPARENT FALSE       STATUS ON       POSITION LR       END #scalebar            END #map


Is georeference the same as geotransform?

Does georeference mean the same as geotransform? If not then what is the difference?


Move shared vertices together

I should move some vertices of a polygon to fix the boundaries of a country, how can I do it while keeping the adjacent polygons still connected? Is there a way to anchor permanently overlapped vertices of adjacent polygons? I'm using Qgis


How to connect stops to road for network dataset?

I have 3 files a bus route network, road network and bus stops. I want the bus stops to be the connections between the road network and the bus route. When I try and build the network dataset I am getting a standalone user-defined junction error. I tried snapping the stops to the bus route and building a network dataset with just these 2 files but still got the same error. I followed the instructions from here Snap point to line in ArcGIS to do that. Does anyone have any suggestions on what I can do to fix this?


How to use the GeoServer REST api to get a PNG representation of a layer?

Does anybody know if I can retrieve by REST service in GeoServer an raster representation of layer?   Just like in for ex. ArcGIS REST Api:   When I send:               MapServer/export?dpi=96&transparent=true&format=png8&bbox=338477.336%2C360036.34849999996%2C619993.648%2C548154.8615&bboxSR=2180&imageSR=2180&size=1064%2C711&f=image      In response, I get png image of layer in defined bbox.


How to define Winkel Tripel in proj 4.8.0?

I have QGIS with proj 4.8.0 installed. I'd like to add Winkel Tripel projection which seems to be defined as               +proj=wintri      But that definition string does not work. Is this a bug in my proj version, or what's the correct definition string?


Tutorial on creating geospatial visualizations with Processing(.org)?

Recently, I've seen examples, (lots of examples ) which use Processing(.org) for creating network visualizations. So far though, I have not been able to find any good tutorials on it. I was wondering if anyone knows a good resource for learning this specific type of visualization?


Beginner HELP please : How to add a WMS layer from GeoServer with OpenLayers?

After doing some basic OpenLayers examples where I used WMS layers from WMS providers like this: _http://maps.opengeo.org/geowebcache/service/wms_ , I wanted then to add a WMS layer from my GeoServer. I tried this but all I get is an empty page:                   map = new OpenLayers.Map('map_element');         var wms = new OpenLayers.Layer.WMS(            "Routes_Maroc",            "http://localhost:8080/geoserver/PFE/wms",             {'layers': 'PFE:morocco_highway'},            {}            );         map.addLayers([wms]);         };      Where PFE is the GeoServer workspace containing the PostGIS layer morocco_highway as in the image below: I couldn't post the image, they told me I need 10 reputation :( Is there sth wrong with the layer parameters in GeoServer or with the code (missing properties in the wms object)? Here is the script section of the code of the OpenLayers preview in GeoServer of "morocco_highway" layer:               <script defer="defer" type="text/javascript">     var map;     var untiled;     var tiled;     var pureCoverage = false;     // pink tile avoidance     OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;     // make OL compute scale according to WMS spec     OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;     function init(){     // if this is just a coverage or a group of them, disable a few items,     // and default to jpeg format     format = 'image/png';     if(pureCoverage) {     document.getElementById('filterType').disabled = true;     document.getElementById('filter').disabled = true;     document.getElementById('antialiasSelector').disabled = true;     document.getElementById('updateFilterButton').disabled = true;     document.getElementById('resetFilterButton').disabled = true;     document.getElementById('jpeg').selected = true;     format = "image/jpeg";     }     var bounds = new OpenLayers.Bounds(     -12.9576148986816, 27.5776710510254,     -0.976616859436035, 36.0192184448242     );     var options = {     controls: [],     maxExtent: bounds,     maxResolution: 0.046800773590803,     projection: "EPSG:900913",     units: 'm'     };     map = new OpenLayers.Map('map', options);     // setup tiled layer     tiled = new OpenLayers.Layer.WMS(     "PFE:morocco_highway - Tiled", "http://localhost:8080/geoserver/PFE/wms",     {     LAYERS: 'PFE:morocco_highway',     STYLES: '',     format: format,     tiled: true,     tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom     },     {     buffer: 0,     displayOutsideMaxExtent: true,     isBaseLayer: true,     yx : {'EPSG:900913' : false}     }     );     // setup single tiled layer     untiled = new OpenLayers.Layer.WMS(     "PFE:morocco_highway - Untiled", "http://localhost:8080/geoserver/PFE/wms",     {     LAYERS: 'PFE:morocco_highway',     STYLES: '',     format: format     },     {     singleTile: true,     ratio: 1,     isBaseLayer: true,     yx : {'EPSG:900913' : false}     }     );     map.addLayers([untiled, tiled]);     // build up all controls     map.addControl(new OpenLayers.Control.PanZoomBar({     position: new OpenLayers.Pixel(2, 15)     }));     map.addControl(new OpenLayers.Control.Navigation());     map.addControl(new OpenLayers.Control.Scale($('scale')));     map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));     map.zoomToExtent(bounds);     // wire up the option button     var options = document.getElementById("options");     options.onclick = toggleControlPanel;     // support GetFeatureInfo     map.events.register('click', map, function (e) {     document.getElementById('nodelist').innerHTML = "Loading... please wait...";     var params = {     REQUEST: "GetFeatureInfo",     EXCEPTIONS: "application/vnd.ogc.se_xml",     BBOX: map.getExtent().toBBOX(),     SERVICE: "WMS",     INFO_FORMAT: 'text/html',     QUERY_LAYERS: map.layers[0].params.LAYERS,     FEATURE_COUNT: 50,     Layers: 'PFE:morocco_highway',     WIDTH: map.size.w,     HEIGHT: map.size.h,     format: format,     styles: map.layers[0].params.STYLES,     srs: map.layers[0].params.SRS};     // handle the wms 1.3 vs wms 1.1 madness     if(map.layers[0].params.VERSION == "1.3.0") {     params.version = "1.3.0";     params.j = e.xy.x;     params.i = e.xy.y;     } else {     params.version = "1.1.1";     params.x = e.xy.x;     params.y = e.xy.y;     }     // merge filters     if(map.layers[0].params.CQL_FILTER != null) {     params.cql_filter = map.layers[0].params.CQL_FILTER;     }     if(map.layers[0].params.FILTER != null) {     params.filter = map.layers[0].params.FILTER;     }     if(map.layers[0].params.FEATUREID) {     params.featureid = map.layers[0].params.FEATUREID;     }     OpenLayers.loadURL("http://localhost:8080/geoserver/PFE/wms", params, this, setHTML, setHTML);     OpenLayers.Event.stop(e);     });     }     // sets the HTML provided into the nodelist element     function setHTML(response){     document.getElementById('nodelist').innerHTML = response.responseText;     };     // shows/hide the control panel     function toggleControlPanel(event){     var toolbar = document.getElementById("toolbar");     if (toolbar.style.display == "none") {     toolbar.style.display = "block";     }     else {     toolbar.style.display = "none";     }     event.stopPropagation();     map.updateSize()     }     // Tiling mode, can be 'tiled' or 'untiled'     function setTileMode(tilingMode){     if (tilingMode == 'tiled') {     untiled.setVisibility(false);     tiled.setVisibility(true);     map.setBaseLayer(tiled);     }     else {     untiled.setVisibility(true);     tiled.setVisibility(false);     map.setBaseLayer(untiled);     }     }     // Transition effect, can be null or 'resize'     function setTransitionMode(transitionEffect){     if (transitionEffect === 'resize') {     tiled.transitionEffect = transitionEffect;     untiled.transitionEffect = transitionEffect;     }     else {     tiled.transitionEffect = null;     untiled.transitionEffect = null;     }     }     // changes the current tile format     function setImageFormat(mime){     // we may be switching format on setup     if(tiled == null)     return;     tiled.mergeNewParams({     format: mime     });     untiled.mergeNewParams({     format: mime     });     /*     var paletteSelector = document.getElementById('paletteSelector')     if (mime == 'image/jpeg') {     paletteSelector.selectedIndex = 0;     setPalette('');     paletteSelector.disabled = true;     }     else {     paletteSelector.disabled = false;     }     */     }     // sets the chosen WMS version     function setWMSVersion(wmsVersion){     // we may be switching style on setup     if(wmsVersion == null)     return;     if(wmsVersion == "1.3.0") {     origin = map.maxExtent.bottom + ',' + map.maxExtent.left;     } else {     origin = map.maxExtent.left + ',' + map.maxExtent.bottom;     }     tiled.mergeNewParams({     version: wmsVersion,     tilesOrigin : origin     });     untiled.mergeNewParams({     version: wmsVersion     });     }     function setAntialiasMode(mode){     tiled.mergeNewParams({     format_options: 'antialias:' + mode     });     untiled.mergeNewParams({     format_options: 'antialias:' + mode     });     }     function setPalette(mode){     if (mode == '') {     tiled.mergeNewParams({     palette: null     });     untiled.mergeNewParams({     palette: null     });     }     else {     tiled.mergeNewParams({     palette: mode     });     untiled.mergeNewParams({     palette: mode     });     }     }     function setWidth(size){     var mapDiv = document.getElementById('map');     var wrapper = document.getElementById('wrapper');     if (size == "auto") {     // reset back to the default value     mapDiv.style.width = null;     wrapper.style.width = null;     }     else {     mapDiv.style.width = size + "px";     wrapper.style.width = size + "px";     }     // notify OL that we changed the size of the map div     map.updateSize();     }     function setHeight(size){     var mapDiv = document.getElementById('map');     if (size == "auto") {     // reset back to the default value     mapDiv.style.height = null;     }     else {     mapDiv.style.height = size + "px";     }     // notify OL that we changed the size of the map div     map.updateSize();     }     function updateFilter(){     if(pureCoverage)     return;     var filterType = document.getElementById('filterType').value;     var filter = document.getElementById('filter').value;     // by default, reset all filters     var filterParams = {     filter: null,     cql_filter: null,     featureId: null     };     if (OpenLayers.String.trim(filter) != "") {     if (filterType == "cql")     filterParams["cql_filter"] = filter;     if (filterType == "ogc")     filterParams["filter"] = filter;     if (filterType == "fid")     filterParams["featureId"] = filter;     }     // merge the new filter definitions     mergeNewParams(filterParams);     }     function resetFilter() {     if(pureCoverage)     return;     document.getElementById('filter').value = "";     updateFilter();     }     function mergeNewParams(params){     tiled.mergeNewParams(params);     untiled.mergeNewParams(params);     }     </script>


error on mxd.save/saveACopy

I'm trying to use arcpy to save an .mxd and am having an issue. It doesn't matter if I use mxd.save or mxd.saveACopy I get the same error. I know it doesn't look like I am doing anything w/ it here, but it's just a portion of my code:               import arcpy     import arcpy.mapping as map     arcpy.env.overwriteOutput = True          env.workspace = r"C:\MGIS\FinalProject2.gdb         mxd = map.MapDocument(r"C:\MGIS\Finalproject2.mxd")     df = map.ListDataFrames(mxd)[0]          for df in map.ListDataFrames(mxd):     df.scale = 2000000          #Add layers into map document     addLayer = map.Layer(OKXcounties)     addLayer1 = map.Layer(contourLabelText)     addLayer2 = map.Layer(contoursClipLyr)     addLayer3 = map.Layer(clipOKXLyr)     map.AddLayer(df, addLayer, "AUTO_ARRANGE")     map.AddLayer(df, addLayer1, "AUTO_ARRANGE")     map.AddLayer(df, addLayer2, "AUTO_ARRANGE")     map.AddLayer(df, addLayer3, "AUTO_ARRANGE")          # Add contour Labels     for lyr in map.ListLayers(mxd):         if lyr.name == "contourLabelText":             lyr.showLabels = True         if lyr.name == "Contour Features":             lyr.transparency = 100          mxd.saveACopy(mxd)      I get the following error:               Traceback (most recent call last):       File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 312, in RunScript         exec codeObject in __main__.__dict__       File "C:\MGIS\geog485\FinalProject2\mxdtest.py", line 7, in <module>         mxd.saveACopy(mxd)       File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\utils.py", line 181, in fn_         return fn(*args, **kw)       File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\_mapping.py", line 668, in saveACopy         self._arc_object.saveACopy(file_name)     AttributeError: MapDocObject: Unable to save.  Check to make sure you have write access to the specified file and that there is enough space on the storage device to hold your document.      Space is not the issue, I have 60 GB of free space and I've checked the windows properties of the .mxd file. Read-only box is unchecked and I've "allowed" all permissions for all groups: ![mxdproperties](http://i.stack.imgur.com/l8Yro.png) Does anyone have any idea how if this is a bug or how I can fix this. It's really holding me up. I'm using ArcInfo 10.0 SP4. Thanks in advance.


GeoAlchemy: AttributeError: type object 'ColumnProperty' has no attribute 'ColumnComparator'

I installed GeoAlchemy using easy_install but when trying to import it returns the following: > Traceback (most recent call last): File "", line 1, in import geoalchemy > File "C:\Python27\ArcGIS10.2\lib\site- > packages\geoalchemy-0.7.2-py2.7.egg\geoalchemy__init__.py", line 2, in from > geoalchemy.base import * File "C:\Python27\ArcGIS10.2\lib\site- > packages\geoalchemy-0.7.2-py2.7.egg\geoalchemy\base.py", line 242, in class > SpatialComparator(ColumnProperty.ColumnComparator): AttributeError: type > object 'ColumnProperty' has no attribute 'ColumnComparator' How to fix this?


Field Calculator not showing some fields

When I open my attribute table, click on a column, and select Field Calculator it opens and doesn't list all of the Fields in my attribute table. Why can't Field Calculator find these Fields?


How do I black out all polygons except one using Geoserver SLD_BODY= parameter in GetMap URL?

I am trying to use the SLD_BODY= parameter to set a style that will black out all polygons except one; the remaining polygon should be transparent. However, the image comes back with all the polygons blacked out, and the transparent polygon isn't visible because of the black polygons behind it. This SLD will work if I create the geoserver SLD config file to draw from, but does not work when I pass the SLD through the URL itself. The non-URL encoded version of the SLD is here:               <?xml version="1.0" encoding="UTF-8"?>     <StyledLayerDescriptor xmlns="http://www.opengis.net/sld"     xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink"     xsi:schemaLocation="http://www.opengis.net/sld     http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd"     xmlns:se="http://www.opengis.net/se">       <NamedLayer>         <se:Name>blackout_transparent</se:Name>         <UserStyle>           <se:Name>blackout_transparent</se:Name>           <se:FeatureTypeStyle>             <se:Rule>               <se:Name></se:Name>           <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">             <ogc:PropertyIsNotEqualTo>               <ogc:PropertyName>state_abbr</ogc:PropertyName>               <ogc:Literal>KS</ogc:Literal>             </ogc:PropertyIsNotEqualTo>           </ogc:Filter>           <se:PolygonSymbolizer>             <se:Fill>               <se:SvgParameter name="fill">#333333</se:SvgParameter>             </se:Fill>           </se:PolygonSymbolizer>         </se:Rule>         <se:Rule>           <se:Name></se:Name>           <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">             <ogc:PropertyIsEqualTo>               <ogc:PropertyName>state_abbr</ogc:PropertyName>               <ogc:Literal>KS</ogc:Literal>             </ogc:PropertyIsEqualTo>           </ogc:Filter>           <se:PolygonSymbolizer>             <se:Fill>               <se:SvgParameter name="fill">#ff2b2f</se:SvgParameter>               <se:SvgParameter name="fill-opacity">0.0</se:SvgParameter>                           </se:Fill>           </se:PolygonSymbolizer>         </se:Rule>       </se:FeatureTypeStyle>     </UserStyle>     </NamedLayer>     </StyledLayerDescriptor>      Is there something wrong with the logic of this SLD or is this possibly a bug with Geoserver?


How to limit vertically the extent of an OpenLayers map?

When I pan north, the map goes out and I see the white background of my HTML. I want to pan vertically and the map to block when it reaches the top (or bottom, respectively). I have tried to put bounds, but this solution puts also bounds horizontally. I want to be able to pan infinitely left or right, but limit the panning up and down. How could I do this? Thanks ![Map out on pan north](http://i.stack.imgur.com/hQ6zT.png)


Dynamically drawing a polygon around another shapefile, ArcGIS 10.2

Let's say I have a vegetation raster that indicates the density of forest all over the world. I also have a shapefile that contains the admin boundaries of each country in the world. The easy part is to make sure the grid cells are within the country boundary, but what I want to do afterwards is to create a separate polygon boundary that will surround the region in question. It is best to do it dynamically based on a certain density threshold, that could vary from country to country. I haven't exactly figured out how to handle that yet, but once I do, how would I go about encasing that data within a polygon that can be saved as another shapefile. I have attached an image of what I want the result to look like. ![Polygon](http://i.stack.imgur.com/Wxlul.jpg) So after a threshold is determined, a polygon will be drawn around the area as tight to the boundary as possible, excuse the freehand above, and then output it as a new shapefile. Is this possible and any ideas on how it can be done? Would using Model Builder be feasible to create a tool that would take the density shapefile, boundary shapefile, and threshold value as inputs to produce a polygon?


How to add dashed line in QGIS print composer

I want to display two maps in the print composer: a main one, and another showing a zoomed in section of the main map. I've drawn a rectangle over the original region and want to add two dashed lines connecting the rectangle to the zoomed in section of the map, but I can't figure out how. I tried using an arrow without an arrowhead, but there isn't an option to make it dashed. I've also tried drawing a flat dashed rectangle, which works but is quite fiddly. Does anyone know of an easier way to perform this simple task? Cheers


How to map all 0.001° graticules that contain land?

I'm trying to map all 0.001° graticules (across the planet) that contain land. My first attempt naively tried to brute force this by literally looping over the entire planet in 0.001° increments and checking if each point contained land or not. Should've done the math first -- not optimal :(. My second attempt tried narrow down the scope by first finding the bounding boxes for known land areas and then doing the same "loop and check" technique over that. I used the "land polygons" from NaturalEarth, however, the bounding boxes I was able to generate from those polygons weren't granular enough. I'm thinking next I'll try to find a larger set (of smaller polygons) so the bounding boxes are more "accurate"... maybe countries instead of land masses? Either case, I'm sure this approach will _eventually_ work, but, I'm thinking there's gotta be something better/more optimal. (Also, it should probably be noted that I'm incredibly new to GIS related things :). Thoughts? Is there a way to do this via a query inside of PostGIS (which is what I'm currently using to store the data)? Or is there a better alternative? Thanks, and let me know if you need any extra clarification.


(R)SAGA: saga_cmd 2.1.0 error? inconsistency?

frequently I am using (R)SAGA, but after SAGA became >2.1.0 the R package is no longer working. The last update for RSAGA was 07/2013. Thus I downgraded SAGA to 2.1.0 (first try was skipping the ppa of johanvdw, second try was from source) in order to be able to use RSAGA again. Actually this was successful I thought because saga_gui ran well. Only the more important saga_cmd brings up this: In bash:               [jejune:~]$ saga_cmd     Error: no arguments for saga call     Error: library          62 loaded module libraries (567 modules):     - garden_webservices     - ihacres      ...               - shapes_grid     - table_tools     - ta_compound              type -h or --help for further information              Inconsistency detected by ld.so: dl-close.c: 762: _dl_close: Assertion `map->l_init_called' failed!      In R I can load the package but all functions come up with this error message:                   rsaga.get.modules('io_gdal')         Error: module         Inconsistency detected by ld.so: dl-close.c: 762: _dl_close: Assertion  `map->l_init_called' failed!         Error in system(command, intern = intern, ...) : error in running command         >      So either there is a workaround to get RSAGA runnning with SAGA >2.1.0 or maybe someone is able to tell me what the error messages mean (and hopefully how to get rid of them)? I really appreciate any hints. Thanks. jejune system in use:     * Ubuntu 14.04     * R version 3.0.2     * SAGA 2.1.0     * RSAGA 0.93-6


Field calculation- Arcpy

I am developing a script to calculate the values of two fields (C and D) based on value of field A (It is a Point feature):               A C D     0.2 1 1     0.2 1 2     0.2 1 3     0.4 2 1     0.5 3 1     0.5 3 2      So the idea is               n = 1     k =0     while i < endrow     {     if a[i]==a[i+1]     c[i]=n     d[i] = k+1     if a[i] < a[i+1]     i=i+1     k=0     c[i]=n+1     d[i]= k+1     }      Not sure - cursor can help me. But is there any way for such comparison and update the column? Thanks adding another complication- field E which has the maximum D for every unique A or C; so it will be:                A C D  E     0.2 1 1 3     0.2 1 2 3     0.2 1 3 3     0.4 2 1 1     0.5 3 1 2     0.5 3 2 2      Because my ultimately goal is to keep only D ==1 and label the remained points with C and E (say: there are 3 points at location 1)               A C D  E     0.2 1 1 3     0.4 2 1 1     0.5 3 1 2      Right now appears, I have to run another combination of search and update cursor after calculation of C and D but if there is any other concise and sleek approach! If I will figure it out - I will post it here!


Link GDAL to consume a WFS

Im using a WFS that is openly available as a demo from mapserver's website               http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities      And now i want to make a client application that can consume this service in C++ (QT) using the GDAL libraries. I have compiled GDAL with xerces and curl as the docs say but apart from that they are not very clear about how to use it for a WFS, im sure the functionality is there because it says it supports it but i cant find any WFS specific documentation so far i have just tried to open a connection and get this error:               GDALAllRegister();     const char *pszFilename = NULL;     pszFilename = "http://demo.mapserver.org/cgi-bin/wfs?";     m_dataset = (GDALDataset*) GDALOpen(pszFilename, GA_ReadOnly);          if( m_dataset == NULL )     {         std::cout << "Dataset is empty" << std::endl;         exit( 1 );     }      Error:               ERROR 4: `/vsimem/http_1/file.dat' not recognised as a supported file format.          Dataset is empty     ERROR 4: Failed to create temporary file:/tmp/file.dat      I have also tried instead of the URL, an XML document that contains the URl like the docs say this shoudl work               <OGRWFSDataSource>         <URL>http://path/to/WFS/service[?OPTIONAL_PARAMETER1=VALUE[&OPTIONNAL_PARAMETER2=VALUE]]</URL>     </OGRWFSDataSource>       but this just says the file isnt a compatible type, any help would be appreciated here


How to combine "positive" with "negative" polygons

I have 2 polygone classes (1 and 2). Inside the polygons are holes (white). Now I want to combine them with the polygon in witch the holes are. Understand? Sorry for that bad english... ![enter image description here](http://i.stack.imgur.com/Auwyp.png) The white holes have to be green or blue, like the sourrounding polygon. Any idea? Thanks!


SQLServer generating invalid WKT

I am a GIS novice using SQL 2008, with C# and the NetTopologySuite WKTReader type to work with some geometries. I have some data which I have been able to save into the database but when I read back out the I receive a 24144 error with suggestions to use MakeValid() to convert it to a valid instance. I don't understand whats wrong with the WKT. I presume its violating an OGC rule but not sure what.               GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POLYGON ((-2.76 49.38905, -2.7600333333333333      49.535166666666662, -2.5833500000000003 49.5352, -2.4087833333333331      49.535166666666662, -2.4087666666666667 49.38905, -2.56075 49.389099999999992,      -2.5552833333333336 49.437733333333334, -2.5552166666666665 49.455183333333331,      -2.5968 49.455183333333331, -2.5967833333333332 49.437733333333334,      -2.5552833333333336 49.437733333333334, -2.56075 49.389099999999992, -2.76 49.38905))))      I am unable to change this data so is there an alternative to reading this out of SQL without having to change it? Thanks for looking


Place milestone for every mile

I have to develop a tool in ArcGIS Server10 with Silver-light API, where I have to place a markersymbol(milestone) on the polyline for every 1 km I have the start_km and end_km ... with M values Please guide me to achieve this tool


Why does Table Manager not work?

After installation of Quantum GIS I tried to use Table Manager Module, but I can't do it. Here is the message:               Nem tudom betölteni a 'tablemanager' modult innen: ['C:/PROGRA~1/Quantum GIS Wroclaw/apps/qgis/./python', 'C:/Users/TamÃ¡s/.qgis/python', 'C:/Users/TamÃ¡s/.qgis/python/plugins', 'C:/PROGRA~1/Quantum GIS Wroclaw/apps/qgis/./python/plugins', 'C:\PROGRA~1\Quantum GIS Wroclaw\bin\python27.zip', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27\DLLs', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27\lib', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27\lib\plat-win', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27\lib\lib-tk', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\qgis\bin', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27\lib\site-packages', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27\lib\site-packages\PIL', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27\lib\site-packages\win32', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27\lib\site-packages\win32\lib', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27\lib\site-packages\Pythonwin', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\Python27\lib\site-packages\wx-2.8-msw-unicode', 'C:\PROGRA~1\Quantum GIS Wroclaw\apps\qgis\python\plugins\fTools\tools']          Traceback (most recent call last):       File "C:/PROGRA~1/Quantum GIS Wroclaw/apps/qgis/./python\qgis\utils.py", line 117, in loadPlugin         __import__(packageName)       File "C:/PROGRA~1/Quantum GIS Wroclaw/apps/qgis/./python\qgis\utils.py", line 283, in _import         mod = _builtin_import(name, globals, locals, fromlist, level)     ImportError: No module named tablemanager          Python verzió:     2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]               QGIS verzió     1.7.4-Wroclaw Wroclaw, 411aff6          Python elérési út: ['C:/PROGRA~1/Quantum GIS Wroclaw/apps/qgis/./python', 'C:/Users/Tam\xc3\xa1s/.qgis/python', 'C:/Users/Tam\xc3\xa1s/.qgis/python/plugins', 'C:/PROGRA~1/Quantum GIS Wroclaw/apps/qgis/./python/plugins', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\bin\\python27.zip', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27\\DLLs', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27\\lib', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27\\lib\\plat-win', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27\\lib\\lib-tk', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\qgis\\bin', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27\\lib\\site-packages', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27\\lib\\site-packages\\PIL', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27\\lib\\site-packages\\win32', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\PROGRA~1\\Quantum GIS Wroclaw\\apps\\qgis\\python\\plugins\\fTools\\tools']


How do I Use OpenLayers Multi-lingual capabilities?

So, OpenLayers has a i18n namespace. But in my example at the bottom of the blog. I am not getting the "Pan Up" which is what I would expect, but instead "PanUp", which is the string that should be translated in en.js. I don't know enough about how this should work to debug it. I couldn't find much in the documentation about this either. How does OpenLayers know what language to use? When I switch to French will it know to pull out the translations of "PanUp" from the fr.js file?


OpenLayers.Format.CQL Regex Problem

I have a cql filter as SQL. Im trying to parse this cql to OpenLayers.Filter using OpenLayers.Format.CQL.read() method. It all works fine since my input is ascii. When I type Turkish characters as VALUE an error occurs. I modifed regex belong to VALUE property in CQL.js as /(^('.+'|\d+(.\d*)?|.\d+))/ Now it accepts non-ascii characters but generated Filter is wrong. The regex i modified might affect somewhere. What i try and what message i get actually like follow               var format_cql = new OpenLayers.Format.CQL;     format_cql.read("NAME = 'ŞAKİR'");      Error: ERROR: In parsing: ['ŞAKİR'], expected one of: VALUE: /^('\w+'|\d+(.\d*)?|.\d+)/ If i type SAKIR instead of ŞAKİR it returns a OpenLayers Comparison object well. It also doesnt allow to type space character in value. Could someone please help me ? Regards


.dxf export in QGIS 2.0.1 gives hatches instead of polylines

This may see like a stupid question, but I'm new to QGIS, so please bear with me. I'm having a problem when saving as .dxf. I export a building layer (polygons) as a .dxf file However in AutoCAD it turns up as a hatch instead of as a closed polyline which is what I'm looking for. I can of course recreate the boundary in AutoCAD, but I would rather just save the data correctly in QGIS. Can anyone help? thank you in advance & best regards Martin


Populate an existing popup with an AttributeInspector after RelationshipQuery returns results

Here's the workflow: A user selects a feature layer polygon, views a popup. A link added to the popup will run a RelationshipQuery to view related records. How can I get the RelationshipQuery results to update the first popup as an AttributeInspector? A second link on the first popup would run a function to add a new record to the related table, that would also need to appear as an AttributeInspector in the first popup. I don't think I'm handling the RelationshipQuery results correctly because the second popup comes back with 'no features selected'. I've run the Query Related Records on the REST feature service so I know the relationship is established. Thanks much for any input B               dojo.require("dijit.form.Button");     dojo.require("dijit.Toolbar");     dojo.require("dijit.layout.BorderContainer");     dojo.require("dijit.layout.ContentPane");     dojo.require("dijit.TitlePane");     dojo.require("esri.map");     dojo.require("esri.toolbars.navigation");     dojo.require("esri.dijit.BasemapGallery");     dojo.require("esri.arcgis.utils");     dojo.require("esri.dijit.Popup");     dojo.require("esri.dijit.AttributeInspector-all");          var popup, popupTemplate;     var startExtent;     var map;     var gallerymaps = [];     var featureLayer, basemapGallery, HybridLayer, ImageryLayer, BasemapLayer, operationalLayer;     var HybridBasemap, ImageryBasemap, BasemapBasemap;     var selectionHandler;     var query,relatedQuery;     var deferred = [];     var viewLink, newLink;          function init() {     esri.config.defaults.map.sliderLabel = null;          popup = new esri.dijit.Popup({     fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,     new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,     new dojo.Color([0, 0, 255]), 2), new dojo.Color([0, 0, 255, 0.25]))     }, dojo.create("div"));          startExtent = new esri.geometry.Extent(...);     map = new esri.Map("map", {     extent: startExtent,     infoWindow: popup     });          //resize the map when the browser resizes     dojo.connect(dijit.byId('map'), 'resize', map, map.resize);          dojo.connect(map, "onClick", function (evt) {     query = new esri.tasks.Query();     query.geometry = evt.mapPoint;     deferred.push(featureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW));     map.infoWindow.setFeatures(deferred);     map.infoWindow.show(evt.mapPoint);     map.infoWindow.resize(325, 210);     });          relatedQuery = new esri.tasks.RelationshipQuery();     relatedQuery.outFields = ["*"];     relatedQuery.returnGeometry = false;     relatedQuery.relationshipId = 0;          // Add a link into the InfoWindow Actions panel     viewLink = dojo.create("a", {     "class": "action",     "innerHTML": "View Activity",     "href": "javascript:void(0);"     }, dojo.query(".actionList", map.infoWindow.domNode)[0]);          // Add a link into the InfoWindow Actions panel     newLink = dojo.create("a", {     "class": "action",     "innerHTML": "Add Activity",     "href": "javascript:void(0);"     }, dojo.query(".actionList", map.infoWindow.domNode)[0]);          // Register a function to be called when the user clicks on     // the link     dojo.connect(viewLink, "onclick", function (evt) {     var feature = map.infoWindow.getSelectedFeature();     exeViewRelated(feature);     });     dojo.connect(newLink, "onclick", function (evt) {     var feature = map.infoWindow.getSelectedFeature();     exeAddRelated(feature);     });          dojo.connect(featureLayer, "onEditsComplete", function () {     featureLayer.refresh();     });          addFeatureLayer();          //working around an arcgis server feature service bug.  Requests to queryRelatedRecords operation fail with feature service 10.     //Detect if request conatins the queryRelatedRecords operation and then change the source url for that request to the corresponding mapservice     esri.setRequestPreCallback(function (ioArgs) {     if (ioArgs.url.indexOf('queryRelatedRecords') !== -1) {     ioArgs.url = ioArgs.url.replace("FeatureServer", "MapServer");     }     return ioArgs;     });     return map;     }          function addFeatureLayer() {     //add the operational layer to the map     operationalLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://.../MapServer");     map.addLayer(operationalLayer);          //define a popup template     popupTemplate = new esri.dijit.PopupTemplate({     title: "{PHYISICALADDRESS}",     fieldInfos: [     { fieldName: "PARCELNO", visible: true, label: "Parcel Number:" },     { fieldName: "OWNERNAME", visible: true, label: "Owner Name:" },     { fieldName: "MAILADDRESS", visible: true, label: "Mailing Address:" },     { fieldName: "MAILLOC", visible: true, label: "Mailing Location:" },     { fieldName: "CONTACT_PHONE_NUMBER", visible: false, label: "Phone Number:" },     { fieldName: "CONTACT_EMAIL", visible: false, label: "Email Address:" },     { fieldName: "ACTIVITY_DESIGNATION", visible: false, label: "Designation:" },     { fieldName: "ACTIVITY_DATE", visible: false, label: "Activity Date:" },     { fieldName: "ACTIVITY_INFO", visible: false, label: "Activity Information:" },     { fieldName: "ACTIVITY_CUSTODIAN", visible: false, label: "Information Custodian:" },     { fieldName: "PROPERTY_LOC_DESC", visible: false, label: "Property Location Description:" }     ],     showAttachments: true     });          featureLayer = new esri.layers.FeatureLayer("http://.../FeatureServer/0", {     mode: esri.layers.FeatureLayer.MODE_SELECTION,     infoTemplate: popupTemplate,     outFields: ["*"],     id: "propertyLayer"     });          map.addLayer(featureLayer);     }          function exeViewRelated(parcelFeature) {     relatedQuery.objectIds = [parcelFeature.attributes.OBJECTID];     featureLayer.queryRelatedFeatures(relatedQuery, function (relatedRecords) {     var fset = relatedRecords[parcelFeature.attributes.OBJECTID];          title = parcelFeature.attributes.PHYISICALADDRESS;     //    content = "Owner Name: " + parcelFeature.attributes.OWNERNAME     //            + "

Mailing Address: " + parcelFeature.attributes.MAILADDRESS     //            + "

Mailing Location: " + parcelFeature.attributes.MAILLOC          var layerInfos = [{ 'featureLayer': featureLayer,     'showAttachments': true,     'isEditable': true,     'fieldInfos': [     { 'fieldName': 'PHYISICALADDRESS', 'isEditable': false, 'label': 'Property Address:' },     { 'fieldName': 'OWNERNAME', 'isEditable': false, 'label': 'Owner Name:' },     { 'fieldName': 'MAILADDRESS', 'isEditable': false, 'label': 'Mailing Address:' },     { 'fieldName': 'MAILLOC', 'isEditable': false, 'label': 'Mailing Location:' },     ]     }];          var attInspector = new esri.dijit.AttributeInspector({     layerInfos: layerInfos     },     //        dojo.create("div", dojo.query(popup.domNode, map.infoWindow.domNode)[0])     //        popup.domNode     dojo.create("div")     );          dojo.place(attInspector.domNode, popup.domNode);          //add a save button next to the delete button     var saveButton = new dijit.form.Button({ label: "Save", "class": "saveButton" });     dojo.place(saveButton.domNode, attInspector.deleteBtn.domNode, "after");          dojo.connect(saveButton, "onClick", function () {     updateFeature.getLayer().applyEdits(null, [updateFeature], null);     });          dojo.connect(attInspector, "onAttributeChange", function (feature, fieldName, newFieldValue) {     //store the updates to apply when the save button is clicked     updateFeature.attributes[fieldName] = newFieldValue;     });          dojo.connect(attInspector, "onNext", function (feature) {     updateFeature = feature;     console.log("Next " + updateFeature.attributes.objectid);     });          dojo.connect(attInspector, "onDelete", function (feature) {     feature.getLayer().applyEdits(null, null, [feature]);     map.infoWindow.hide();     });          dojo.connect(map.infoWindow, "onHide", function () {     featureLayer.clearSelection();     });          map.infoWindow.setTitle(title);     //        map.infoWindow.setContent(content);     //        map.infoWindow.setContent("

");     map.infoWindow.setContent(attInspector.domNode);          //        map.infoWindow.setFeatures(fset);     //map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));     map.infoWindow.resize(500, 500);     });     }          function exeAddRelated(parcelFeature) {     relatedQuery.objectIds = [parcelFeature.attributes.OBJECTID];     featureLayer.queryRelatedFeatures(relatedQuery, function (relatedRecords) {     var fset = relatedRecords[parcelFeature.attributes.OBJECTID];          title = parcelFeature.attributes.PHYISICALADDRESS;     // content = "owner name: " + parcelfeature.attributes.ownername     // + "

mailing address: " + parcelfeature.attributes.mailaddress     // + "

mailing location: " + parcelfeature.attributes.mailloc          // content = content + "

Phone Number: " + fset.features[0].attributes.CONTACT_PHONE_NUMBER     // + "

Email Address: " + fset.features[0].attributes.CONTACT_EMAIL     // + "

Designation: " + fset.features[0].attributes.ACTIVITY_DESIGNATION     // + "

Activity Date: " + fset.features[0].attributes.ACTIVITY_DATE     // + "

Activity Information: " + fset.features[0].attributes.ACTIVITY_INFO     // + "

Information Custodian: " + fset.features[0].attributes.ACTIVITY_CUSTODIAN     // + "

Property Location Description: " + fset.features[0].attributes.PROPERTY_LOC_DESC;          dojo.connect(map.infoWindow, "onHide", function () {     featureLayer.clearSelection();     });          var layerInfos = [{ 'featureLayer': featureLayer,     'showAttachments': true,     'isEditable': true,     'fieldInfos': [     { 'fieldName': 'CONTACT_PHONE_NUMBER', 'isEditable': true, 'label': 'Phone Number:' },     { 'fieldName': 'CONTACT_EMAIL', 'isEditable': true, 'label': 'Email Address:' },     { 'fieldName': 'ACTIVITY_DESIGNATION', 'isEditable': true, 'label': 'Designation:' },     { 'fieldName': 'ACTIVITY_DATE', 'isEditable': true, 'label': 'Activity Date:' },     { 'fieldName': 'ACTIVITY_INFO', 'isEditable': true, 'label': 'Activity Information:' },     { 'fieldName': 'ACTIVITY_CUSTODIAN', 'isEditable': true, 'label': 'Information Custodian:' },     { 'fieldName': 'PROPERTY_LOC_DESC', 'isEditable': true, 'label': 'Property Location Description:' }     ]     }];          var attInspector = new esri.dijit.AttributeInspector({     layerInfos: layerInfos     },     dojo.create("div")     );          //add a save button next to the delete button     var saveButton = new dijit.form.Button({ label: "Save", "class": "saveButton" });     dojo.place(saveButton.domNode, attInspector.deleteBtn.domNode, "after");          dojo.connect(saveButton, "onClick", function () {     updateFeature.getLayer().applyEdits(null, [updateFeature], null);     });          dojo.connect(attInspector, "onAttributeChange", function (feature, fieldName, newFieldValue) {     //store the updates to apply when the save button is clicked     updateFeature.attributes[fieldName] = newFieldValue;     });          dojo.connect(attInspector, "onNext", function (feature) {     updateFeature = feature;     console.log("Next " + updateFeature.attributes.objectid);     });          dojo.connect(attInspector, "onDelete", function (feature) {     feature.getLayer().applyEdits(null, null, [feature]);     map.infoWindow.hide();     });          map.infoWindow.setTitle(title);     // map.infoWindow.setContent(content);     map.infoWindow.setContent(attInspector.domNode);     //        map.infoWindow.setFeatures(fset);     //map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));     map.infoWindow.resize(500, 500);          });     }


Dynamic Tiling Isn't working(create tiles on demand isn't working)

I have a map where users are going to primarily being viewing a particular area, so I cached this area and checked off the dynamic tiling option inside of the service properties this worked fine for a while every time the map would load and a user went outside my tiled area the system behaved as expected it started the tiling process tiled that area they went to and stopped. Then the dynamic tiling quit operating, it won't start at all no matter where I go on my map I of course have checked the web and this site but have found no answers every time my end user goes goes to the area outside my tiled area they get a massive blank spot all the way around the tiled area. Any suggestions as what to try will be greatly appreciated. EDIT: I'm using arcgis server and my client is a webpage that we built to use the map, it uses the javascript api.


Postgis reorder mixed up linestring chunks / max_segment_length(linestring)?

I imported ~1000 paths from somewhere into my postgis database to a linestring field. I had the problem that the paths were divided into chunks, and those chunks were mixed up in some cases. Suppose a linestring that was divided at point number 50 and 70:   1. Chunk A: points 1-50   2. Chunk B: points 51-70   3. Chunk C: points 71-100 When I migrated that into my database, they got mixed, so the resulted linestring could end up like this:   1. Chunk A: points 1-50   2. Chunk C: points 71-100   3. Chunk B: points 51-70 So that produces a jump from 50 to 71 and another one from 100 to 51 I want to be able to reorder those chunks so I would like to construct a SQL query to detect which paths are mixed, then I could manually rearrange them. It would be desirable to have a SQL update query to solve this problem, but I think that detection is easier (I presume there are ~5% or less of paths with errors) EDIT: I think the script for detection could check if a path contains a pair of consecutive points too far away. Maybe a SQL that orders paths from the path that contains the longest segment, would be good. How could I make a function to get the length of the max segment in a linestring?


Is there a Python WMS client (thin client analogue of OpenLayers)?

I'm making a geoportal based on (Geo)Django 1.5, PostgreSQL 9.1 + PostGIS 2.0, QGIS MapServer and OpenStreet Map or Google Maps WMS services for the base layer. It seems like there is no problem, but I want implement a Slim Client nearby the Rich Client. For the rich client I will use GeoEXT library, but I can't find something complex for the slim client -- displaying, navigating, editing maps ability + some plugins as in OpenLayers, BUT without any JavaScript -- only server. In a word, I want something like here http://demo.mapserver.org/tutorial/section3.html (MapServer HTML templates) but for all WMS services (not only MapServer) and it must be a library written in Python (or Django plugin ideally). I've found Python OWSLib, but it's not enough -- I must parse GetCapabilities, available layers by myself, I must make navigation and other plugins by myself, etc. Does anyone know, is there such a thing?


Convertion of multiple csv automatically to shp

I have more than two hundreds similar csv files with columns (x, y, value1, value2, objectName). I need to convert them automatically to shp files with x and y columns as the coordinates. Could you please advice how to do it quickly using Python scripting? Thanx!


Clip polygons with other polygons based on matching attributes

I have two shapefiles, one which contains event locations and the the other of which represents regions where events take place.   * **Events** polygons with `year` and `region_name` attributes   * **Regions** polygons, which also have `year` and `region_name` attributes The Event polygons sometimes extend beyond their proper Region. Regions sometimes change boundaries, which is why they also have a `year` attribute. **I would like to clip each Event polygon using the appropriate Region polygon, i.e. the one with matching`year` and `region_name` attributes.** Here is an image I made to illustrate the basic idea: ![Illustration of Event polygons being clipped by the appropriate Region polygons](http://i.stack.imgur.com/MqqN7.gif) Some solutions I've tried but which have been unsatisfactory:   * Doing it manually (selecting each event and region by hand and clipping them), which seems unnecessarily tedious   * Using _Select By Location_ to isolate the Events in each Region, which still requires working with each selection manually   * Using _Intersect_ , which 1) leaves lots of event "remnants" outside their proper regions and 2) "oversplits" by dividing all Event polygons by all Region polygons, regardless of year Note: I use both QGIS 1.8 and ArcMap 10.1. I can't install extensions for ArcGIS (I don't have administrative access) but I can use Python scripts.


Generating Interactive Tiles using Nodejs, Mapnik, and PostGIS for Leaflet

I am looking to do something like this but where I have all the data on the same server. I've been following through the set of tutorials @ sparkgeo.com/labs/big/ and I'm having some difficulty. Ultimately I'd like to get it working with `Leaflet` like the tutorial @ sparkgeo.com/labs/bigleaflet/ but I can't get the version on the prior tutorial to work either. So the final version will be generating `R Shiny` interactive maps and layers from tiles accessed through `Leaflet` generated by `Postgis` by means of `node.js` using `mapnik` and `mapbox`. The `Wax` libraries used in that tutorial have been removed so I installed this. I pointed the tiles in the `HTML` file to `http://localhost:8000/{z}/{x}/{y}.png` and pointed to my location of `wax.g.min.js`. No census tracts are showing up with I run the `cencon.js` code. Similarly with the `Leaflet` version of the `HTML` file, I pointed to the localhost for the layers and they are not displaying. They are successfully loaded to the `PostGIS` database and changing the database login info. OK, so I'm new to all of this and I'm wondering if I'm missing something obvious. I did not alter the code other than what I previously mentioned. Is there something else I needed to do to generate the tiles @ `http://localhost:8000/{z}/{x}/{y}.png`? Also, now that `Wax` is superseded, do you have any links for more suitable tutorials using `mapbox`? Thank you for your thoughts.


Editing multiple SLDs

I have to edit and maintain multiple SLD's. Is there a tool to do bulk edits/ updates? I have used tools like Atlas SLD to one SLD at a time, and could use XML editing tools to potentially edit multiple but not sure if I can edit multiple SLD's using SLD editors. Thanks, Ramesh


ArcPy Add Graph Window

The arcpy MakeGraph_management tool suggests that a graph is stored via an in_memory representation that can be either:   1. added to the host app or   2. saved using SaveGraph_management. The graph appears to be stored in a manner similar to an in_memory layer, e.g. `in_memory/<name>.grf`. In the case of an in_memory layer, it is possible to add the layer to the map (ToC). I can not find documentation describing how to programmatically add the `.grf` (an instance of the arcpy.Graph() class) to the map. I am interested in having the graph remain interactive - so I am not using arcpy.mapping to add the graph to a map element. Does anyone have documentation that describes how to render the graph generated by MakeGraph?


My self-hosted CartoDB map references /api/v1/map -- No route matches

I'm using a self-hosted install of CartoDB. When I try to publish a visualization using the sample Europe data the visualization page references /api/v1/map which results in a routing error. ActionController::RoutingError (No route matches [GET] "/api/v1/map"): I'm serving CartoDB with Apache/Passenger, and all of the other endpoints seem to be working. I have a ProxyPass setting in Apache to proxy /api/v1/sql requests to the CartoDB SQL API service, but /api/v1/map (and other /api/v1 requests) are passed through to CartoDB itself. I'm not sure what other info would be useful. Please let me know and I'll provide it.


How do I get the path of a project, or layer file in PyQGIS?

I am generating new raster files from vector layers on a project. I would like to save them in the same directory as the project or layer files. How do I find this path using PyQGIS?


CartoDB/SQL Console?

Lacking much programming experience, I've spent a lot of time familiarizing myself with HTML, CSS, and SQL over the past couple of days so that I could make a layer selector for a CartoDB visualization. I eventually made a layer selector, but my SQL queries weren't working for some reason. Apparently I had to make the data table non-private. I was informed that I could have looked at the console and it would have told me the error. I would appreciate if someone would tell how I can access this console. I have no idea what that is. I was thinking it could be accessed via Linux terminal, but my platform right now is Windows.


How to show vector features in OpenLayers after hiding it?

I did change some vector features style (through check-boxes) using style property :               var features = layer.features;          for( var i = 0; i < features.length; i++ ) {       //features[i].style = { visibility: 'hidden' };         features[i].style = 'none';      }          layer.redraw();      But now if I check the box again, it supposed to display again but nothing happens! I tried:                    features[i].style = 'block';      OR          features[i].style = 'delete';       then redraw the layer.. but this doesn't work Any Idea ?


Saving/Loading QGIS style .qml and avoid specified symbology

Is it possible to save QGIS styles without the symbology style? This may seem like a strange question, but I am trying to automatically set the ValueMap widget under layer properties via a plugin for QGIS 2.0. I'm not able to set the key:value pair in this version, as it's not possible until version 2.2. What i'd like to do is save the .qml file without any symbology style specified. This is so that when the .qml is loaded via pyQGIS, the user identified symbology doesn't change with it (only the layer property widgets). I've tried to edit the .qml style file by removing the information pertaining to "symbols". This results in changing the symbology to a simple black line, not remaining unchanged as set by user as I was hoping.


Callback method geocode items nominatim not work

function addr_search() {         var inp = document.getElementById("addr");              $.getJSON('http://nominatim.openstreetmap.org/search?format=json&limit=5&q=' + inp.value, function(data) {             var items = [];                  $.each(data, function(key, val) {                 bb = val.boundingbox;                 latitude = val.lat;                 longitude = val.lon;                 items.push("
" + val.display_name + '
');             });                  $('#results').empty();             if (items.length != 0) {                 $('
', { html: "Search results:" }).appendTo('#results');                 $('
', {                     'class': 'my-new-list',                     html: items.join('')                 }).appendTo('#results');             } else {                 $('
', { html: "O endereço não foi encontrado" }).appendTo('#results');             }         });     }      This method returns the geocode Nominatim. When clicked calls the method passing chooseAddr latitude, longitude, and limits the osm_type enreço clicked. But, I am not able to connect those returns. If I do so it works:                  $.each(data, function(key, val) {             latitude = val.lat;             longitude = val.lon;             items.push("
" + address.value + city.value + '
');         });      But, I need to bring the bounds of the address to zoom using this attribute and it does not work:               $.each(data, function(key, val) {         bb = val.boundingbox;         latitude = val.lat;         longitude = val.lon;         items.push("
" + val.display_name + '
');     });      I've tried various ways and I know it's something silly, but I could not seem to solve this.


Compare cell value of a row

How can I compare the cell value of row(n) with cell value of row (n+1){where n = 1, 2, ...}               import arcpy          arcpy.env.workspace = "C:\RG\Kings County\Test.gdb"     inFC = arcpy.GetParameterAsText(0)     inFC = "MergeAll_"     outFC = "C:\RG\Kings County\Test.gdb\MergeAll_Sort"     arcpy.env.overwriteOutput = 1          try:              #sorts field_id in ascending order and writes to outFC         arcpy.Sort_management(inFC, outFC,[["Field_ID", "Ascending"]])              rows = arcpy.UpdateCursor(outFC)              for row in rows:             rowCur = row             if rowCur.getValue("Field_ID")==row.getValue("Field_ID"):                 rowCur.setValue("New_FID", 0.0)         del row, rows          except Exception as e:         print e      I did not get any error, nor did the code write 0.0 under field name "New_FID". Would appreciate your help. Thanks


How to adjust data digitized from an erroneously georeferenced basemap?

I have made quite a big georeferencing error, by attributing one of the control points of the map with a value that is 2 km less than the actual value, on the horizontal axis. The georeferenced map looked more like a right- angle trapezoid. I realized this only after digitizing, so my question is, can I tweak/adjust somehow the digitized lines so they become correct according to the new shape of the map? I have imagined rescaling around a point that is different than the center of the map, in Global Mapper, but I seem to be long way off achieving anything. Thank you!


Handler tool in MapBasic

Have any handler or procedure, that call automatic when the click or unclick menu item or button? Similiar **SelChangedHandler**.


Mapinfo workspace won't open

When I try to open my workspace file, renamed 'FILE' here, it gives this error: (FILE.wor:201) Found [)] while searching for [A string constant]. (FILE.wor:204) set is an invalid indentifier. (FILE.wor:204) Unable to create map layer. (FILE.wor:204) Unable to create map group layer. I have tried opening the file in notepad to see if I could find a 201 or 204 but there are none, so it must be embedded somewhere in the file. Who can tell me how to fix this? Thanks! Bertus


How to draw line in leaflet using postGIS road data

![enter image description here](http://i.stack.imgur.com/yqUEn.png) I have few points from server and I want to draw a line with this point on road. But the leaflet drawing point to point line as shown in picture in orange color. But I want to draw the line according to the blue line. How it can be done? Thanks


Overlapping lines representation

Cartography question. I do have administrative boundries for counties in polygon FC. What tool do I use to prioritise display of features. In example, when lines overlap- I want to show only 1 dashed line instead 2 overlapping lines with shifted dashes. Similary, when I do have 2 separate polygon feature classes, I want to prioritise certain class over another in way, that higher rank is displayed and lower is not. Of course in both cases rules would affect only overlapping segments of the polygon or polyline, if it would be more convinient. [EDIT] On the picture overlapping lines in area 1 should look like line in the area 2. ![Example](http://i.stack.imgur.com/BLcFg.jpg)


Using custom contextMenu in Arcobjects(C# and ArcMap)

I added a new custom tree to TOC which looks like this:               IObjectClass         IFeature         IFeature ...     IObjectClass         IRow ...      made context menu using this sample http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000026q000000 and it shows up alright, but unfortunatelly its context menu commands are not doing anything. Here is onNodeMouseClick:               private void tvwSelected_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)     {         if (e.Button == MouseButtons.Right)         {             m_contextItem = e.Node.Tag;                  UID menuID = new UIDClass();             if (e.Node.Tag is IFeature)                 menuID.Value = "{d32ae970-abb8-4f02-a592-9181f1307ed9}";             else                 return;             ICommandBar cmdBar = (ICommandBar)_application.Document.CommandBars.Find(menuID, false, false);             cmdBar.Popup(0, 0);         }     }      and here is context menu:               public ContextMenuTest()     {         AddItem("esriCore.FeatureFindContextMenuItems", 1); //flash         AddItem("esriCore.FeatureFindContextMenuItems", 2); //zoom         AddItem("esriCore.FeatureFindContextMenuItems", 3); //identify         AddItem("esriCore.FeatureFindContextMenuItems", 6); //unselect     }      I believe the probblem could be that IFeature is not what these commands require, or the whole thing works in totaly different way. Any help would be appreciated.