Connecting centroids of lines sharing same intersection in QGIS?

Connecting centroids of lines sharing same intersection in QGIS?

I have this street network of the center of Turin (IT), composed by lines representing streets, and black points representing intersections.

I have computed the centroids of each line and displayed these as red points. Now I would like to connect the centroids (red points) of each line that share the same intersection (black points) as in the "B" scheme of this picture:

The attribute of the intersections, that are the black points, are simple Ids:

Whereas in the attributes of the lines representing the streets I have the Ids, the start node (that is the Id of the black point where the line begin) and the end node (the Id of the black point where the line end.)

Do someone have an idea about how this can be done?

I've thought about pharsing the lines start points over the end points and vice-versa, but I really don't know how to do this.

The script below assumes there are 3 feature layers:

  1. Point layer - nodes or street junctions
  2. Polyline layer - street segments. Associated table has 2 fields of integer type to store sequential number of from and to node.
  3. Polyline layer called 'connections' to store results.

Only essential part of the script shown below, i.e. no error handling, parameters assignment, etc:

## LIST TO STORE STREET SEGMENT MIDDLE POINT AND CONNECTED NODES ids bigList=[] ## ITERATE THROUGH SEGMENT TABLE AND AAPEND ABOVE LIST with arcpy.da.SearchCursor(theLinksLayer, ("[email protected]",linksFromI,linksToI)) as cursor: for row in cursor: pC=row[0].centroid bigList.append((pC,row[1],row[2])) del row, cursor ## ARRAY TO STORE PAIRS OF POINTS AT INTERSECTING SEGMENTS theList=arcpy.Array() ## ITERATE THROUGH EACH NODE and CALCULATE NUMBER OF CONNECTED SEGMENTS for i in xrange(nNodes): pList=[] for triple in bigList: if i in triple: p=triple[0] pList.append(p) nCon=len(pList) if nCon>1: ## ITERATE THROUGH COMBINATION OF SEGMENTS AND CONNECT THEIR MIDDLE POINTS for a in itt.combinations(xrange(nCon),2): theList.removeAll() theList.add(pList[a[0]]) theList.add(pList[a[1]]) l=arcpy.Polyline(theList) curT.insertRow((arcpy.Polyline(theList),1))

Input sample, nodes labelled by their sequential number: Output sample:


  • Conservation Planning
    • Conservation Technical Assistance
    • Technical Service Providers
    • Economics
    • GIS
    • National Resources Inventory
    • Rapid Watershed Assessment
    • Agronomy
    • Biology
    • Cultural Resources
    • Invasive Species
    • Manure Management
    • Nutrient Management
    • Pest Management
    • Threatened & Endangered Species
    • Cropland
    • Range & Pasture
    • Forestry
    • STC Minutes
    • STC Agenda

    Geographic Information System (GIS)

    A GIS is a combination of software and data designed to view and manage information about geographic places, analyze spatial relationships and model spatial processes. It provides a framework for gathering and organizing spatial data and related information so it can be displayed and analyzed. USDA-NRCS views spatial data and GIS as one of many tools to accomplish our program missions and technical needs.

    Colorado NRCS Employees can find GIS announcements, training documents and references on the Colorado NRCS GIS Sharepoint (see "Related Links").

    GIS Data

    (see "Highlights" to download)

    • Environmental Easements &ndash NRCS Stewardship Land Easement boundaries and centroids are available in Internet Map Services.
    • Geospatial Data Gateway - Provides One Stop Shopping for natural resources or environmental geospatial data at anytime, from anywhere, to anyone. The Gateway allows you to choose your area of interest, browse and select data from our catalog, customize the format, and have it downloaded or shipped on CD for use in GIS software.
    • National Water & Climate Center - In support of the Snow Survey and Water Supply Forecasting Program, the National Water and Climate Center produces a wide range of products, such as reports, maps, graphs, and datasets.
    • Web Soil Survey &ndash Web based application that allows customers to prepare soil reports and maps, and to download soil data.

    More Information

      - The mission of the National Geospatial Center of Excellence (NGCE) is to provide the USDA NRCS with technical leadership and expertise in geosciences: mapping science, cartography, geographic information systems (GIS), aerial photography, remote sensing and global position systems (GPS), elevation and imagery data, natural resources data, and geospatial technology.


    Chris Mueller
    State GIS Specialist
    Denver Federal Center
    Building 56, Room 2604
    PO Box 25426
    Denver, CO 80225-0426

    2 Answers 2

    claim: all ten lines go through the point $frac<1><3>(a+b+c+d+e).$

    proof: i will use complex numbers instead of vectors. chooses a coordinate system so that the circle has unit radius and the point $D$ is at $1.$ let the complex numbers $a, b, c=e^<2igamma>, d = 1, e = e^<2iepsilon>.$ the line through the center of the triangle $ABC$ and orthogonal to line $DE$ has the parametric form $mbox < line1:>frac<1><3>(a+b+c) +frac<3>e^ , s mbox< real>$ in the same way the line through the center of the triangle $ABE$ orthogonal to $DC$ has the parametric form $mbox < line2:>frac<1><3>(a+b+e) + frac<3>e^, t mbox< real>$

    solving the two equation and their complex conjugates, we find that $ s =e^ + e^ <-iepsilon>mbox < and >t = e^ + e^<-igamma>$ and the common points of intersection as claimed.

    A geographic information and remote sensing based model for prediction of Oncomelania hupensis habitats in the Poyang Lake area, China

    A model was developed using remote sensing and geographic information system technologies for habitat identification of Oncomelania hupensis, the intermediate host snail of Schistosoma japonicum, in the Poyang Lake area, China. In a first step, two multi-temporal Landsat TM 5 satellite images, one from the wet and the second from the dry season, were visually classified into different land-use types. Next, the normalized difference vegetation index was extracted from the images and the tasseled-cap transformation was employed to derive the wetness feature. Our model predicted an estimated 709 km2 of the marshlands in Poyang Lake as potential habitats for O. hupensis. Near-ground temperature measurements in April and August yielded a range of 22.8-24.2 degrees C, and pH values of 6.0-8.5 were derived from existing records. Both climatic features represent suitable breeding conditions for the snails. Preliminary validation of the model at 10 sites around Poyang Lake revealed an excellent accuracy for predicting the presence of O. hupensis. We used the predicted snail habitats as centroids and established buffer zones around them. Villages with an overall prevalence of S. japonicum below 3% were located more than 1200m away from the centroids. Furthermore, a gradient of high-to-low prevalence was observed with increasing distance from the centroids. In conclusion, the model holds promise for identifying high risk areas of schistosomiasis japonica and may become an important tool for the ongoing national schistosomiasis control programme. The model is of particular relevance for schistosome-affected regions that lack accurate surveillance capabilities and are large enough to be detected at most commercially available remote sensing scales.

    Using geographical information systems and cartograms as a health service quality improvement tool

    Introduction: Disease prevalence can be spatially analysed to provide support for service implementation and health care planning, these analyses often display geographic variation. A key challenge is to communicate these results to decision makers, with variable levels of Geographic Information Systems (GIS) knowledge, in a way that represents the data and allows for comprehension. The present research describes the combination of established GIS methods and software tools to produce a novel technique of visualising disease admissions and to help prevent misinterpretation of data and less optimal decision making. The aim of this paper is to provide a tool that supports the ability of decision makers and service teams within health care settings to develop services more efficiently and better cater to the population this tool has the advantage of information on the position of populations, the size of populations and the severity of disease.

    Methods: A standard choropleth of the study region, London, is used to visualise total emergency admission values for Chronic Obstructive Pulmonary Disease and bronchiectasis using ESRI's ArcGIS software. Population estimates of the Lower Super Output Areas (LSOAs) are then used with the ScapeToad cartogram software tool, with the aim of visualising geography at uniform population density. An interpolation surface, in this case ArcGIS' spline tool, allows the creation of a smooth surface over the LSOA centroids for admission values on both standard and cartogram geographies. The final product of this research is the novel Cartogram Interpolation Surface (CartIS).

    Results: The method provides a series of outputs culminating in the CartIS, applying an interpolation surface to a uniform population density. The cartogram effectively equalises the population density to remove visual bias from areas with a smaller population, while maintaining contiguous borders. CartIS decreases the number of extreme positive values not present in the underlying data as can be found in interpolation surfaces.

    Discussion: This methodology provides a technique for combining simple GIS tools to create a novel output, CartIS, in a health service context with the key aim of improving visualisation communication techniques which highlight variation in small scale geographies across large regions. CartIS more faithfully represents the data than interpolation, and visually highlights areas of extreme value more than cartograms, when either is used in isolation.

    Keywords: Cartography Health Services Visualisation.

    Copyright © 2014 The Authors. Published by Elsevier Ltd.. All rights reserved.

    Create parallel line and find intersection with other line

    I'm trying to create parallel lines of the bold, black lines in this picture:

    It is just an arbitrary (convex) quadrilateral, with the blue corner points known. The bold, black lines start at 25% of each blue line and end at 75%. So, say $lambda_1 = 0.25$ and $lambda_2 = 0.75$, then

    $egin Start = lambda_1 cdot c_2 + (1-lambda_1) cdot c_1 End = lambda_2 cdot c_2 + (1-lambda_2) cdot c_1 end$

    Where $c_1$ and $c_2$ are the two points of a blue line.

    Now my actual questions. 1.) How to create a parallel line to such a bold black line? It should have the same length, and be guided along the dashed green line towards the centroid. If I'm not mistaken, the centroid is at the intersection of the two bimedians (the dashed green lines). Since it is a quadrilateral, this should be the same as the mean value of the 4 points at the corners. Therefore, the centroid is known as well.

    2.) Ok, so say I got the parallel lines. Then I move them all towards the centroid, until their endpoints touch, creating a scaled-down version of this quadrilateral. Is there a way to obtain the coordinates of these 4 new corner points in general?

    By the way, I did a search and came up with this topic, but there it is guided along the perpendicular line, and my green dashed lines are not perpendicular to the blue/black ones.

    Edit: The equation for a dashed green line from the center of the blue line towards the centroid would be

    $egin lambda cdot C + (1 - lambda) cdot left( frac <2> ight) end$

    Where $C$ is the centroid. The equation for a bimedian would be

    $egin gamma cdot left( frac <2> ight) + (1 - gamma) cdot left( frac <2> ight) end$

    So somehow, the $Start$ and $End$ points must be moved in the direction of one of these lines above, in order to create a $NewStart$ and $NewEnd$ point. Then the equation for the parallel line would simply be

    $egin eta cdot NewEnd + (1-eta) cdot NewStart end$

    Once the 4 expressions for the parallel lines are known, the intersection can be calculated, hopefully resulting in a relatively easy expression for the 4 new corner points.

    Logic behind location of shear centre

    When we apply a vertical shear force Sy and the structure is symmetric about x axis, then why is it logical to have the position of shear center at the location of intersection of line of action of shear force and x axis?

    If we go by basic definition then the moment about the shear center due to shear forces should be 0, so the line of action of external shear force is logical, but when we consider moment about x- axis, rather than getting cancelled, I think they get added.

    eg. This is the situation.

    Now look at the final solution depicting the shear flows

    So as I suggested, instead of moments being equal and opposite, I think they exactly equal in magnitude and direction. So where am I getting a wrong interpretation?

    EDIT:- I tried to keep the question general and explained accordingly, to be specific the question is as follows:-

    The thin-walled single cell beam shown in Fig. 20.11 has been idealized into a combination of direct stress carrying booms and shear stress only carrying walls. If the section supports a vertical shear load of 10 kN acting in a vertical plane through booms 3 and 6, calculate the distribution of shear flow around the section.

    Boom areas: B1 =B8 =200mm2, B2 =B7 =250mm2, B3 =B6 =400mm2, B4 = B5 =100mm2.

    x is horizontal and y is vertical

    It is a closed section beam. An idealized version of an airplane wing

    As technology advances we encounter more available data on moving objects, thus increasing our ability to mine spatio-temporal data. We can use this data for learning moving objects behavior and for predicting their locations at future times according to the extracted movement patterns.

    In this paper we cluster trajectories of a mobile object and utilize the accepted cluster centroids as the object's movement patterns. We use the obtained movement patterns for predicting the object location at specific future times. We evaluate our prediction results using precision and recall measures. We also remove exceptional data points from the moving patterns by optimizing the value of an exceptions threshold.

    Connected sets dont have subsets that are both open and closed [duplicate]

    A topological space $X$ is connected if and only if there are no nonempty proper subsets of $X$ that are both open and closed in $X$ .

    Since the theorem is if and only if statement, we must prove it in both directions.

    ( $Rightarrow$ ) Let $X$ be a connected topological space and for the sake of contradiction, suppose $U$ is an open and closed proper subset of $X$ . Because $U$ is open, nonempty and proper subset of $X$ , it must be the case that $X-U$ is closed and likewise nonempty and proper subset of $X$ because $U$ is closed, it follows that $X-U$ is open. But now we have that $U cup (X-U) = X$ , $U cap (X-U) = emptyset$ and $U$ , $X-U$ are open, nonempty subsets of $X$ , which means that $X$ is not connected. This is a contradiction, because we assumed $X$ to be connected therefore, it must be the case that if $X$ is connected, then there are no nonempty proper subsets of $X$ that are both open and closed in $X$ .

    ( $Leftarrow$ ) We will prove this direction by contrapositive method.

    Let $X$ be a topological space and suppose that $A$ is a nonempty proper subset of $X$ that is both open and closed in $X$ . But since $A$ is open, it must be the case that the complement of $A$ , i.e. $X-A$ is closed similarly, since $A$ is closed, $X-A$ must be open. Also, since $A$ is a nonempty proper subset of $X$ , it follows that so is $X-A$ . Observe, that $A cap (X-A) = emptyset$ , and $A cup (X-A) = X$ . So now we have that both, $A$ and $X-A$ are open nonempty proper subsets of $X$ that are disjoint and $A cup (X-A) = X$ . Hence, it must be the case that $X$ is not connected.

    My question is: Both directions look almost identical, is this ok, or shall I work on this in some another way?

    1.6 Exercises

    Think about the terms ‘GIS’, ‘GDS’ and ‘geocomputation’ described above. Which (if any) best describes the work you would like to do using geo* methods and software and why?

    Provide three reasons for using a scriptable language such as R for geocomputation instead of using an established GIS program such as QGIS.

    Name two advantages and two disadvantages of using mature vs recent packages for geographic data analysis (for example sp vs sf).


    Eddelbuettel, Dirk, and James Joseph Balamuta. 2018. “Extending R with C++: A Brief Introduction to Rcpp.” The American Statistician 72 (1): 28–36.

    Pebesma, Edzer, Daniel Nüst, and Roger Bivand. 2012. “The R Software Environment in Reproducible Geoscientific Research.” Eos, Transactions American Geophysical Union 93 (16): 163–63.

    Longley, Paul A., Sue M. Brooks, Rachael McDonnell, and Bill MacMillan, eds. 1998. Geocomputation: A Primer. Chichester, Eng. New York: Wiley.

    Openshaw, Stan, and Robert J. Abrahart, eds. 2000. Geocomputation. London New York: CRC Press.

    Longley, Paul. 2015. Geographic Information Science & Systems. Fourth edition. Hoboken, NJ: Wiley.

    Talbert, Richard J. A. 2014. Ancient Perspectives: Maps and Their Place in Mesopotamia, Egypt, Greece, and Rome. University of Chicago Press.

    Neteler, Markus, and Helena Mitasova. 2008. Open Source GIS: A GRASS GIS Approach. Third. New York, NY: Springer.

    Coppock, J Terry, and David W Rhind. 1991. “The History of GIS.” Geographical Information Systems: Principles and Applications, Vol. 1. 1 (1): 21–43.

    Wulf, Andrea. 2015. The Invention of Nature: Alexander von Humboldt’s New World. New York: Alfred A. Knopf.

    Livingstone, David N. 1992. The Geographical Tradition: Episodes in the History of a Contested Enterprise. Oxford, UK Cambridge, USA: John Wiley & Sons Ltd.

    Bivand, Roger, Edzer J Pebesma, and Virgilio Gómez-Rubio. 2013. Applied Spatial Data Analysis with R. Vol. 747248717. Springer.

    The Economist. 2016. “The Autonomous Car’s Reality Check.” The Economist.

    Wickham, Hadley. 2014a. Advanced R. CRC Press.

    Chambers, John M. 2016. Extending R. CRC Press.

    Brzustowicz, Michael R. 2017. Data Science with Java: [Practical Methods for Scientists and Engineers]. First. Beijing Boston Farnham: OReilly.

    Garrard, Chris. 2016. Geoprocessing with Python. Shelter Island, NY: Manning Publications.

    Bivand, Roger, and Albrecht Gebhardt. 2000. “Implementing Functions for Spatial Statistical Analysis Using the Language.” Journal of Geographical Systems 2 (3): 307–17.

    Bivand, Roger, and Markus Neteler. 2000. “Open Source Geocomputation: Using the R Data Analysis Language Integrated with GRASS GIS and PostgreSQL Data Base Systems.” In Proceedings of the 5th International Conference on GeoComputation, edited by Markus Neteler and Roger S. Bivand.

    Rowlingson, B. S, and P. J Diggle. 1993. “Splancs: Spatial Point Pattern Analysis Code in S-Plus.” Computers & Geosciences 19 (5): 627–55.

    Rowlingson, Barry, and Peter Diggle. 2017. Splancs: Spatial and Space-Time Point Pattern Analysis.

    Venables, W. N., and B. D. Ripley. 2002. Modern Applied Statistics with S. Fourth. New York: Springer.

    Majure, James J., and Albrecht Gebhardt. 2016. Sgeostat: An Object-Oriented Framework for Geostatistical Modeling in S+.

    Ripley, Brian D. 2001. “Spatial Statistics in R.” R News 1 (2): 14–15.

    Akima, Hiroshi, and Albrecht Gebhardt. 2016. Akima: Interpolation of Irregularly and Regularly Spaced Data.

    Jr, Paulo J. Ribeiro, and Peter J. Diggle. 2016. geoR: Analysis of Geostatistical Data.

    Baddeley, Adrian, Ege Rubak, and Rolf Turner. 2015. Spatial Point Patterns: Methodology and Applications with R. CRC Press.

    Bivand, Roger. 2001. “More on Spatial Data Analysis.” R News 1 (3): 13–17.

    Bivand, Roger. 2017. Spdep: Spatial Dependence: Weighting Schemes, Statistics and Models.

    Bivand, Roger, and Nicholas Lewin-Koh. 2017. Maptools: Tools for Reading and Handling Spatial Objects.

    Bivand, Roger. 2003. “Approaches to Classes for Spatial Data in R.” In Proceedings of DSC, edited by Kurt Hornik, Friedrich Leisch, and Achim Zeileis.

    Rowlingson, Barry, Adrian Baddeley, Rolf Turner, and Peter Diggle. 2003. “Rasp: A Package for Spatial Statistics.” In Proceedings of the 3rd International Workshop on Distributed Statistical Computing, edited by Kurt Hornik.

    Pebesma, Edzer J, and Roger S Bivand. 2005. “Classes and Methods for Spatial Data in R.” R News 5 (2): 9–13.

    Pebesma, Edzer, and Benedikt Graeler. 2018. Gstat: Spatial and Spatio-Temporal Geostatistical Modelling, Prediction and Simulation.

    Calenge, C. 2006. “The Package Adehabitat for the R Software: Tool for the Analysis of Space and Habitat Use by Animals.” Ecological Modelling 197: 1035.

    Hijmans, Robert J. 2016. Geosphere: Spherical Trigonometry.

    Bivand, Roger, and Colin Rundel. 2018. Rgeos: Interface to Geometry Engine - Open Source (’Geos’).

    Hijmans, Robert J. 2017. Raster: Geographic Data Analysis and Modeling.

    Bivand, Roger S. 2000. “Using the R Statistical Data Analysis Language on GRASS 5.0 GIS Database Files.” Computers & Geosciences 26 (9): 1043–52.

    Bivand, Roger. 2016a. Rgrass7: Interface Between GRASS 7 Geographical Information System and R.

    Bivand, Roger. 2016b. Spgrass6: Interface Between GRASS 6 and R.

    Brenning, Alexander, Donovan Bangs, and Marc Becker. 2018. RSAGA: SAGA Geoprocessing and Terrain Analysis.

    Brenning, Alexander. 2012a. ArcGIS Geoprocessing in R via Python.

    Muenchow, Jannes, Patrick Schratz, and Alexander Brenning. 2017. “RQGIS: Integrating R with QGIS for Statistical Geocomputing.” The R Journal 9 (2): 409–28.

    Kahle, D, and Hadley Wickham. 2013. “Ggmap: Spatial Visualization with Ggplot2.” The R Journal 5: 144–61.

    Lamigueiro, Oscar Perpinan. 2018. Displaying Time Series, Spatial, and Space-Time Data with R. Second. Boca Raton: Chapman and Hall/CRC.

    The conference took place at the University of Leeds, where one of the authors (Robin) is currently based. The 21 st GeoComputation conference was also hosted at the University of Leeds, during which Robin and Jakub presented, led a workshop on ‘tidy’ spatial data analysis and collaborated on the book (see for more on the conference series, and papers/presentations spanning two decades).↩

    A laptop with 4GB running a modern operating system such as Ubuntu 16.04 onward should also be able to reproduce the contents of this book. A laptop with this specification or above can be acquired second-hand for

    US$100 in many countries nowadays, reducing the financial/hardware barrier to geocomputation far below the levels in operation in the early 2000s, when high-performance computers were unaffordable for most people.↩

    Watch the video: Using Enable Tracing in QGIS to easily create polygons from existing lines