Finding shortest cumulative route (i.e. best 'hub') between networked points

How do I find the shortest cumulative route (i.e. best ‘hub’) between networked points?

I have a dataset where some but not all of the points in the network connect to each other, however it is possible to go from any one point to another via the network. My problem is that these points have different attributes, such that I need to find the shortest cumulative route between the points in each group (i.e. the best ‘hub’ that overall anyone in those points can get to the quickest/shortest average distance from all the other points in the group), as well as the overall ‘hub’ for all the points.

I’m not sure how to do this in QGIS—-much less how to format my dataset for it, since it’s not a stereotypical road or transportation network—-or whether there is a better alternative with which to accomplish the analysis. The spatial distance between the points is actually irrelevant, because the ‘length’ component for distance is the number of nodes between points (i.e. going through point B to reach point C from point A is shorter than going through points D and E when traveling between A and B).

ArcGIS 10: Create an event linear layer from a point layer based on directionality

I have a point layer that reflects the speed limits and a line layer of the roads. The location of the speed sign indicates in which direction the speed limit applies.

How can I make linear event table on top of the road layer that reflects the speeds? So for each segment, return two speed attributes, one for each direction.

Speed/road layer

Is there a way to access the GeoProcessing tools in QGIS, in code

Is there a way to access the GeoProcessing tools in QGIS, in code? I want to find the Difference between two layers and make a new shapefile with the result.It can be manually done by selecting vector->GeoProcessing Tools->Difference. But how to do it in my code? (I use python)
Please help me to find a solution to this problem

Updating MXD layer definitionQuery in arcpy is very slow

The code segment below has been extracted from a larger project. In short, I have an MXD which I want to generate multiple PDFs based on different criteria. The code below works. It loops through each of the layers within the MXD and updates the definitionQuery and the results are fine. On my desktop, the part of the code that sets the definitionQuery takes about 2 seconds, but the published code on the server takes over 40 seconds. Since that bit of code is called for each item in layer_parameter_list, the time of the report jumps from about a minute to multiple minutes.

When I update the defintionQuery, does the MXD get written to the drive? Does it re-filter the data then? On the server, the scratch is on a shared drive which could explain why it is slower. What can I do to improve performance? Can I tell the MXD not to be written? If the re-filtering is occurring, can I disable that until all definitionQuerys have been updated for all layers?

def function_that_iterates_over_data_and_generates_pdf_pages_from_mxd(mxd, extent):
    layer_parameter_list = [
        # field 1,    field 2,  field 3
        ['Company1', 'Value X',    'Value 1'],
        ['Company1', 'Value Y',    'Value 2'],

        ['Company2', 'Value X',    'Value 1'],
        ['Company2', 'Value Y',    'Value 2'],

    layer_queries = [
        ['layer_1', """"FIELD_1"='{0}' and "FIELD_2"='{1}'""",
                    """"FIELD_1"='{0}'' and "FIELD_2"='{1}'"""],
        ['layer_2', """"FIELD_2"='{1}' and "FIELD_3"='{2}'""",
                    """"FIELD_2"='{1}'' and "FIELD_3"='{2}'"""],
        ['layer_3', """"FIELD_1"='{0}' and "FIELD_3"='{2}'""",
                    """"FIELD_1"='{0}'' and "FIELD_3"='{2}'"""],

    dfs = arcpy.mapping.ListDataFrames(mxd)

    lyr_dict = {}
    for df in dfs:
        # Take opportunity to zoom each Dataframe as we build our
        # dictionary
        df.extent = extent
        for lyr in arcpy.mapping.ListLayers(mxd, '', df):
            if lyr.isFeatureLayer or lyr.isServiceLayer:
                lyr_dict[,] = lyr

    for (page_number, query_parameters) in enumerate(layer_parameter_list):
        # this block takes ~2 seconds on my desktop, but 40+ seconds on the server
        for (dfi, df) in enumerate(dfs):
            for layer_query in layer_queries:
                criteria = layer_query[dfi + 1].format(*query_parameters)
                arcpy.AddMessage("Criteria: " + criteria)#this was the problem line
                lyr = lyr_dict[layer_query[0],]
                lyr.definitionQuery = criteria

        file_name = 'Page_{0}'.format('%02s' % page_number)
        arcpy.mapping.ExportToPDF(mxd, file_name)

EDIT: added back in the AddMessage line which was the cause of the slow down.

Geoprocessing Tools on ArcGIS 10.2 and Visual Studio 2012 -issues

I am migrating one of the existing project (custom Geo-processing tool- class library project) source code which runs on ArcGIS 10 SP4 and Visual studio 2010. This is working fine. I am could run the project and able to add this tool in ArcTool box. Publish this as GP service and consumed in application.

I am moving this code to new machine which Windows 2012 server and ArcGIS 10.2 and Visual studio 2012. The source code is fetched from TFS and and code is built successfully after updating ArcGIS libraries to 10.2 When I run the project in VS2012 – class library (starting – ArcMap.exe with specific mxd document as input) break points are not hit.

After doing some research I have found that ESRI Link here I have to update ArcMap.exe.config file. After updating config file to use Framework 4.0 break points are set but not getting hit. Whenever I run the class library project MXD is opens, but the break points are not getting hit and not able to debug the code. Project properties in VS2012 is same as I used in VS2010 (checked Register COM Exception) and enabled debugging.

a) Why VS2012 is not hitting breaking points?
b) Dll is successfully built, but I am not seeing this custom tool box in “Add tool ” box in ArcTool box.

I am not sure what am missing or some changes in ArcGIS 10.2. Please help.

Extract aregular gride of points (x,y) values inside a polygon in arcgis10.2

This question may be frequently asked .But until know there is no clear answer .

I need to extract a regular grid of points inside a polygon .In every time i construct several polygons from the specified polygon and get the vertices that looks as net and convert it to excel file.

But know i need extract points ( x,y coordinates )regularly and save it to excel file.

Can any one has experience in arcgis 10.2 program help me to do that?

Looking for Python module to do lat lon calculations

I’m looking for a Python module that can provide some / all of the following services using latitude/longitude to define points:

Distance between two points
Point in polygon 
Distance along a multi-point path 
Identifier of closest point from a dict of points with identifiers 
Distance from a point to each point in a dict containing points with identifiers

You get the idea… Any suggestions?

How can I GROUP BY linear spatial clusters with PostGIS?

I have a series of points in a horizontal line, arranged into discrete spatial clusters by the underlying data pattern. Here’s an example of what they look like:

enter image description here

How can I use PostGIS to group them spatially into the highlighted sets A, B and C?

This is a harder problem than it initially seemed to me. So far I’ve tried:

  • Using ST_X() to order them, then lag() to identify points between which there are gaps. Unfortunately this just groups the points into “gap” groups and “interior” groups.

  • Using convex hulls around arbitrary spatial thresholds. This both failed to separate all clusters and had the side effect of creating mid-cluster separations. (For future reference, this was a dumb idea.)

  • Using ST_GeoHash() to cluster them. This doesn’t accurately catch the linear nature of the geometry.

Any assistance greatly appreciated.

Error:The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception

I am developing custom geoprocessing tool (class-library project) on ArcGIS 10.2. This project uses Oracle.DatAccess from ODP.NET 1.0 . This is a simple tool which queries – oracle 10g database and returns a distinct records from a specific table.

This tool is working fine from tool box but when this tool is published in REST, it throws
below error:

Error:The type initializer for ‘Oracle.DataAccess.Client.OracleConnection’ threw an exception

ArcGIS server 10.2, Visual Studio 2012.

Server: Windows 2012 -6bit Operating system

Oracle client : installed both oracle 32 and oracle 64 bit


Any pointer on this issue?

April 29: Additional details

To begin with, this custom GP tool project was working in ArcGIS 10.0 for last 2 years successfully. As part of technology migration activity, I am upgrading this project to 10.2. As mentioned, am using Windows 2012 server (64 bit OS) where ArcGIS Desktop and ArcGIS server 10.2 has been installed in same box. Oracle client 32, 64 bit has been installed. Path is set as above.

ArcGIS Grouping Analysis Error

I am trying to run the Grouping Analysis tool from Esri’s ArcGIS Spatial Statistics/Mapping Clusters toolbox. I have run the tool successfully on the same input layer using a different spatial weights matrix, but when I try to run the tool with an IDW spatial weights matrix the tool fails. I have not seen this type of error before. See image…

enter image description here

Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam