postgis

How to find all points away from some polygon?

What I need is to find all points away from rectangle for 10km. Points geometry is the_geom1, rectangles (polygon) geometry is the_geom2. SRID of them is 4258. I tried: SELECT * FROM table1,table2 WHERE ST_DWithin(table1.the_geom1,table2.the_geom2,10000) and table1.gid=2; But the result is not Ok. ...

Continents/Countries borders in PostGIS (Polygon vs Linestring)

Hello guys, I would like to insert the polygon containing Europe in my PostGIS database. I have the follwoing extremes points: NW = NorthWest Border(lat=82.7021697 lon=-28.0371000) NE = NorthEast Border(lat=82.7021697 lon=74.1357000) SE = SouthEast Border(lat=33.8978000 lon=74.1357000) SW = SouthWest Border(lat=33.8978000 lon=-28....

How to put together two queries?

In the title is what I need. CREATE TABLE newTable1 AS SELECT t2.name,t2.the_geom2 FROM t1,t2 WHERE ST_Contains(ST_Expand(t2.the_geom2,0.05),t1.the_geom1) and t1.gid=2; CREATE TABLE newTable2 AS SELECT t1.the_geom,t1.label FROM t1 WHERE t1.gid=2; First query result is all points within polygon and apart from it for 5min where ...

Google maps api,Postgis,Multipolygon

Hello all PostGis WKT format of Multipolygon is: MULTIPOLYGON( ((20.229 39.409,20.2241 39.401,20.220 39.410,20.229 39.409)), ((20.209 39.407,20.223 39.400,20.211 39.402,20.209 39.4076)) ) Google Maps api v3 Polygon is: var triangleCoords = [ new google.maps.LatLng(25.774252, -80.190262), new google.maps.LatLng(18.466465, -66....

PostgreSQL: Can't use DISTINCT for some data types

Hi, I have a table called _sample_table_delme_data_files which contains some duplicates. I want to copy its records, without duplicates, into data_files: INSERT INTO data_files (SELECT distinct * FROM _sample_table_delme_data_files); ERROR: could not identify an ordering operator for type box3d HINT: Use an explicit ordering operator...

JPA/Hibernate Native Queries do not recognize Parameters

I am using Hibernate/JPA to execute native PostGIS queries. The problem with these queries is that they need parameters that are not of the classical X = 'value' form. For example, the following lines crash String queryString = "select * from Cell c where ST_DWithin(c.shape, SetSRID(ST_GeomFromEWKT('POINT(:lon :lat)'),4326), 0.1)"; ...

Django & Postgis : Distance lookup using ST_Distance_sphere

In Django documentation, I read this (http://docs.djangoproject.com/en/dev/ref/contrib/gis/geoquerysets/#id7): On every distance lookup but dwithin, an optional third element, 'spheroid', may be included to tell GeoDjango to use the more accurate spheroid distance calculation functions on fields with a geodetic coordinate system (e.g...

GIS: need to add data to a shape file

Hi folks I tried posting this question earlier but was unsuccessful so I'm trying again I imported a shape (set of points) file into postgres and have a table (hist_info) with additional data also in postgres. I tried creating a VIEW with data that I need from each files but for a reason I can't figure out as to why my GIS layer (creat...

PostGIS intersection troubleshooting

I just started using PostGIS & Postgresql and everything is running smoothly for the most part. When I try to find which MULTIPOLYGON s a POINT lies in I'm getting stuck. I have two separate points that I am certain lie inside one and only one shape that is of MULTIPOLYGON data type in my database. They are not the same points and the...

PostgreSQL Error: geometry contains non-closed rings

I am desperately trying to backup using pgAdmin III my database and I receive an error: geometry contains non-closed rings. How can I get around this?? ...

html5 canvas: server or client fast transforms from longitude latitude to pixel values

I am working on some maps and animations using the html5 canvas element (example visible here.) I would like to be able to efficiently generate pixel-valued linestrings (x1, y1, x2, y2), ideally from PostGIS, based on the geometry of the canvas. That is, in pseudo-geojson: "Coordinates":"[[-122.0, 35.0], [-121.0, 36.0]]" might outpu...

how to proceed further this gis project?

For my company in house use i want to develop a gis project with simple goals. To display all places with name wherever my company presents,over the normal country map. Connect main office with branch offices graphically ( by line ). By clicking a place user will be directed to a new page containing information about the place. add new...

Google Maps: Get points contained within a user-drawn polygon?

A local real estate agent is wanting to add Google maps to his web site that display his listings. However, rather than just showing map markers to all his properties, he wants the web site visitor to be able to draw an arbitrary polygon on the map, click a button, and then display all his houses within those bounds. My understanding i...

Postgis random point inside a polygon

Hello all If i have a polygon in Postgis how can i find-calculate random points inside this polygon? ...

MySQL VS PostGres/POSTGIS spatial database support

We're building a small-sized GIS Web application (as a school project) right now. In terms of spatial database support and capabilities, which is better? :) thanks everyone! ...

Display Map like OpenStreetMap

Hello, everybody. I like the way OpenStreetMap display its map. It almost looks like Google Map. I have already installed GeoServer and PostGis on my notebook. I also got this cloudmade osm file for my country, Indonesia. I downloaded indonesia.osm.bz2. I successfully imported it into my PostGis and did setup it on my GeoServer but i...

GeoDjango setup: ERROR: could not access file "$libdir/postgis-1.5": No such file or directory

Update: thought I'd solved it, but I hadn't... please see below. I'm installing GeoDjango on Mac OSX. I've followed the Mac install instructions, which all went smoothly, and am now creating a spatial database template for PostGIS. However, when I try to load the PostGIS SQL routines, I get ERROR: could not access file "$libdir/post...

Write raw SQL for PostGIS

I'm trying to input some data into a PostgreSQL 8.4 database with a PostGIS template. I'm unable to UPDATE polygons: > UPDATE my_table SET coords = POINT(1, 1) UPDATE 0 1 > UPDATE my_table SET box = POLYGON(((1, 1), (2, 3), (3, 3), (1, 1))) ERROR: function polygon(record) does not exist > UPDATE my_table SET box = POLYGON((1, 1), (2,...

Unions of polygons (ST_UNION for Geography type)

Hi everyone, I am looking for a function that will return the intersection of 2 or more polygons (geography type). I am aware of ST_UNION, ST_COLLECT but it works only for geometry type. Any tip will be really appreciated ...

PostGIS: Finding LineStrings that overlap a box

I want to specify a box (i.e. 2 points) and select all the linestrings that are either within or intersect the box. SELECT * FROM pub_trail_segment WHERE st_force_2d(pub_trail_segment.geometry) && ST_SetSRID(ST_MakeBox2D(ST_GeomFromEWKT('SRID=4326;POINT(48.25077560316286 -124.46710205078124)'), ST_GeomFromEWKT('SRID=4326;POINT(50.474370...