I am using postGreSQL (9.3) and postGIS (2.1). I have a table containing names and circles (point + radius).
Given a name and a circle (point + radius), I would like to find all the database lines that contains (circles that intersect my circle) AND (share the same name). Is it possible using postGIS ?
Here is what I have so far, taken from other questions on this site. Please note that I am just beginning to learn postGreSQL :
--create table
CREATE TABLE circles (
city VARCHAR(50),
geog geography
);
-- insert sample values
INSERT INTO circles (city, geog)
VALUES ('Lannion', geometry(ST_Buffer(geography(ST_GeomFromText('POINT(48.732084 -3.459144)')), 1000)));
INSERT INTO circles (city, geog)
VALUES ('Lannion', geometry(ST_Buffer(geography(ST_GeomFromText('POINT(48.732084 -3.459144)')), 2000)));
INSERT INTO circles (city, geog)
VALUES ('Lannion', geometry(ST_Buffer(geography(ST_GeomFromText('POINT(48.732084 -3.459144)')), 3000)));
INSERT INTO circles (city, geog)
VALUES ('Lannion', geometry(ST_Buffer(geography(ST_GeomFromText('POINT(48.732084 -3.459144)')), 4000)));
INSERT INTO circles (city, geog)
VALUES ('anotherName', geometry(ST_Buffer(geography(ST_GeomFromText('POINT(48.732084 -3.459144)')), 1000))); -- not selected because the name is different
-- search (need help for this one)
SELECT ST_Buffer(geometry(ST_MakePoint(48.732084, -3.459144)), 2500) FROM circles;
I can't make sense of the output of the SELECT
query so far. Also, it doesn't have any constraint on the city name. I would like to have as output the first two inserts in this case.