[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: tmap and point counts per spatial area

From   "Sergiy Radyakin" <>
Subject   Re: st: tmap and point counts per spatial area
Date   Tue, 14 Oct 2008 15:27:54 -0400

Hello Andre!

AFAIK neither -tmap- nor -spmap- does what you request.

But you could try doing it yourself. Google for "point-in-polygon"
algorithms, there are several quite easy ones available (including
source code). -shp2dta- will store the beginning point of a polygon 2
times (begin and end), if I am not mistaken. This will matter
sometimes. (for odd/even-feature algorithms). Be careful, when your
point's coordinates fall exactly on the edge (in the corner).

Most algorithms are formulated for a one polygon case. Converted
shapefiles may have donut-shaped areas, which are described a
combination of individual polygons.   (E.g. consider map of South
Africa, with Lesotho in the middle). The situation could potentially
be recursive (enclave within enclave) . E.g. from Statoids:

"West Bengal has many small exclaves within the Rajshahi division of
Bangladesh, and vice versa. According to Brendan Whyte's thesis, there
are 106 of them. For the height of complexity, a part of Dahala
Khagrabari, India is surrounded by Bangladeshi territory (part of
Upanchowki Bhajni, Bangladesh), which is itself surrounded by Balapara
Khagrabari, India, which in turn is surrounded by Bangladesh. This is
the world's only counter-counter-enclave."

Most algorithms are readily available for shapefiles. I personally
enjoy MapWinGIS library. But it can't be used directly in Stata, you
have to write a plugin or a standalone exe.

Best regards, Sergiy Radyakin

On Tue, Oct 14, 2008 at 12:12 AM, Friedrich Huebler <> wrote:
> Andre,
> Before you invest time learning -tmap-, install -spmap-, an update to
> -tmap- by the same author, Maurizio Pisati.
> . ssc d spmap
> The help file is very detailed. You can also search Google for "spmap"
> to find sites with documentation.
> Friedrich
> On Mon, Oct 13, 2008 at 9:36 PM, Andre Duszynski <> wrote:
>> I've stumbled across tmap as an option for thematic mapping but am
>> wondering to what extent can spatial joins be undertaken within Stata
>> - i'm currently using MapInfo to do these before bringing the data
>> back into Stata 10.
>> Is it possible to import spatial regions (import polygons through
>> mif2data; MapInfo Australian census statistical collection districts)
>> and a related .dta which contains geocoded clinical information (point
>> data; individual summary records with lats and longs), and then use
>> Stata to undertake a count of points per region?
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index