[postgis-users] Trouble getting PostGIS data to display in MapServer

Jason Burkhardt jburkhardt at usgs.gov
Thu Jul 14 12:50:42 PDT 2005


Much thanks to everyone who presented ideas.
As suggested first by Nicolas the coordiantes were indeed wrong.  I
couldn't see this before because I didn't have the symbol set to anything.
Combining the 2 suggestions I am now able to see the circle.
Again, thanks to all who helped.

Jason




|---------+--------------------------------------------->
|         |           Stephen Woodbridge                |
|         |           <woodbri at swoodbridge.com>         |
|         |           Sent by:                          |
|         |           postgis-users-bounces at postgis.refr|
|         |           actions.net                       |
|         |                                             |
|         |                                             |
|         |           07/14/2005 03:24 PM               |
|         |           Please respond to PostGIS Users   |
|         |           Discussion                        |
|---------+--------------------------------------------->
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                                  |
  |       To:       PostGIS Users Discussion <postgis-users at postgis.refractions.net>                                                                 |
  |       cc:                                                                                                                                        |
  |       Subject:  Re: [postgis-users] Trouble getting PostGIS data to   display     in    MapServer                                                |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|




Jason,

1) what are the results of this SQL query if you enter it into psql or
pgadmin?

SELECT astext(force_collection(force_2d(point)),'NDR'),oid::text from
  cities WHERE point && setSRID('BOX3D(-169.987500000013
  -5.67031250002,-48.9999999999865 85.0703125)'::BOX3D, 4326 )

Do you get any rows in response to this query?

2) If the query above is working and returns results, you might want to
move the discussion over to the mapserver list (just a thought).

3) simplify the problem
   a) make sure your symbol is "circle"
   b) size is 50
   c) LATER STATUS DEFAULT
   d) EXTENT of the mapfile covers -169.987500000013
-5.67031250002,-48.9999999999865 85.0703125
   e)
http://yourserver/cgi-bin/mapserv?mode=map&layers=all&map=/path/to/mapfile.map


which should return an image in the browser or an error you can read.
You can also try shp2img -m /path/to/mapfile -o test.png

-Steve W.

Jason Burkhardt wrote:
> Just tried setting it to circle & I'm still not seeing anything in my
> viewer.
> Here's what I'm looking at in my PostgreSQL log when it is making the
> query:
> 2005-07-14 14:46:14 LOG:  00000: statement: DECLARE mycursor BINARY
CURSOR
> FOR SELECT asbinary(force_collection(force_2d(point)),'NDR'),oid::text
from
> cities WHERE point && setSRID('BOX3D(-169.987500000013
> -5.67031250002,-48.9999999999865 85.0703125)'::BOX3D, 4326 )
> I'm not really sure what I should be looking for in my apache logs as I
> don't see any layer names passed there.
> I guess the closest thing I see is queries such as this:
> [14/Jul/2005:14:46:13 -0400] "GET
>
/chameleon//common//wrapper/drawmap.php?map_session_mode=1&run_query=0&sid=42d6b2ea16674&dummy=0.97557200+1121366772&UniqId=1121366568806722

>  HTTP/1.1" 200 13497 "http://emmmadev:8081/chameleon/samples/emmma.phtml"
>
> Jason
>
>
>
>
>
> |---------+--------------------------------------------->
> |         |           Paul Ramsey                       |
> |         |           <pramsey at refractions.net>         |
> |         |           Sent by:                          |
> |         |           postgis-users-bounces at postgis.refr|
> |         |           actions.net                       |
> |         |                                             |
> |         |                                             |
> |         |           07/14/2005 02:27 PM               |
> |         |           Please respond to PostGIS Users   |
> |         |           Discussion                        |
> |---------+--------------------------------------------->
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|

>   |
|
>   |       To:       PostGIS Users Discussion
<postgis-users at postgis.refractions.net>
|
>   |       cc:
|
>   |       Subject:  Re: [postgis-users] Trouble getting PostGIS data to
display in    MapServer
|
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|

>
>
>
>
> Try setting your SYMBOL to "circle" or really anything other than the
> default (which I think is dimensionless and therefor immune to SIZE).
> When you set your postgresql statement logging on, do you see
> mapserver making queries? If so, what do they look like?
> Does the apache hit in your apache logs include the cities layer
> name? (Ie, are you sure your client is asking for it?)
> P
>
> On 14-Jul-05, at 11:00 AM, Jason Burkhardt wrote:
>
>
>>Thanks for the quick response.
>>I've tried with just about every combination of lat/long (including
>>-72)
>>with no results.  I was just using the list here:
>>http://www.realestate3d.com/gps/uslatlongdegmin.htm so I'm really
>>not sure
>>if they're all hosed or what.  My current viewer's extents extend from
>>central america up to the north pole so I figured I would have hit
>>something in the area by now ;)
>>I modified my .map file as per your suggestions to look like this:
>>        CONNECTION "user=postgres password=pgadmin dbname=test
>>host=localhost port=5432"
>>        DATA "point from cities using unique oid using SRID=4326"
>>I assume that's what you meant for the DATA clause.  I know for
>>sure that
>>MapServer is connecting to the database & executing the queries, I
>>can see
>>as much in the PostgreSQL logs.
>>If I set the layers status to default it's turned off when I load
>>up my
>>viewer & I'm still unable to display it when I turn it on and
>>refresh the
>>viewer.
>>
>>Jason
>>
>>
>>
>>
>>
>>|---------+--------------------------------------------->
>>|         |           Nicolas Ribot <nicky666 at gmail.com>|
>>|         |           Sent by:                          |
>>|         |           postgis-users-bounces at postgis.refr|
>>|         |           actions.net                       |
>>|         |                                             |
>>|         |                                             |
>>|         |           07/14/2005 01:45 PM               |
>>|         |           Please respond to Nicolas Ribot;  |
>>|         |           Please respond to PostGIS Users   |
>>|         |           Discussion                        |
>>|---------+--------------------------------------------->
>>
>>>---------------------------------------------------------------------
>>>---------------------------------------------------------------------
>>>--------|
>>>
>>
>>|
>>
>>       |
>>  |       To:       PostGIS Users Discussion <postgis-
>>users at postgis.refractions.net>
>>                         |
>>  |
>>cc:
>>                                                                     |
>>  |       Subject:  Re: [postgis-users] Trouble getting PostGIS
>>data to display in
>>MapServer                                                      |
>>
>>
>>>---------------------------------------------------------------------
>>>---------------------------------------------------------------------
>>>--------|
>>>
>>
>>
>>
>>
>>Hi Jason,
>>
>>Just some thoughts:
>>
>>try to explicitly add PG port in your connection string (5432 is the
>>default)
>>try to set the layer's status to DEFAULT in order to force its
>>display.
>>in your DATA clause, maybe try adding "using unique oid using
>>SRID=4326".
>>
>>Are you sure your points' extent fall in your mapserver map extent ?
>>Shouldn't Albany's longitude be -72 instead of 72 (West from greenwich
>>?)
>>
>>Nicolas
>>
>>
>>On 7/14/05, Jason Burkhardt <jburkhardt at usgs.gov> wrote:
>>
>>
>>>I'm really sure this must be something simple I'm missing, but I'm
>>>at my
>>>wits end and am not getting any further by staring at it.
>>>Hopefully a
>>>fresh set of eyes can help me out.
>>>I'm running MapServer & have a viewer up displaying data from a
>>>variety
>>>
>>
>>of
>>
>>
>>>sources (WMS, .tif's, shapefiles) and would like to include
>>>PostGIS data.
>>>I created a simple PostgreSQL db with a table called cities (this
>>>table
>>>
>>
>>was
>>
>>
>>>created with oids) that has a name, state_name and point field.
>>>I created the point field as such:
>>>      select AddGeometryColumn('cities', 'point', 4326, 'POINT', 2);
>>>A sample of the data I'm inserting looks like this:
>>>      insert into cities (name, state, point) values('Albany', 'NY',
>>>GeometryFromText('POINT(73 42)',4326));
>>>
>>>I then created 2 indexes as so:
>>>      CREATE INDEX cities_index ON cities USING GIST (point
>>>GIST_GEOMETRY_OPS)
>>>      CREATE INDEX cities_index_oid ON cities (name)
>>>I've also done the second index with point as the unique column, I
>>>don't
>>>really care which it is at this point.
>>>
>>>Onto MapServer my layer definition looks like this:
>>>LAYER
>>>  CONNECTIONTYPE postgis
>>>  CONNECTION "user=postgres password=pgadmin dbname=test
>>>host=localhost"
>>>  DATA "point from cities"
>>>  NAME "PostGIS Cities Test"
>>>  TYPE POINT
>>>  STATUS ON
>>>  CLASS
>>>      COLOR 255 0 0
>>>      SIZE 50
>>>  END
>>>  PROJECTION
>>>    "init=epsg:4326"
>>>  END
>>>END
>>>
>>>Every other layer I have is also 4326.  It's connecting to the
>>>database &
>>>not throwing any errors that I can see from the PostgreSQL logs
>>>(I've run
>>>them with varying levels of verbosity).  MapServer does not return a
>>>
>>
>>broken
>>
>>
>>>image when the layer is turned on, I just don't see the point
>>>displayed.
>>>I would appreciate any comments/insight.
>>>
>>>Thanks,
>>>Jason
>>>
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list