[mapserver-users] Zoom to something and display in one shot from MapServer CGI.

Basques, Bob (CI-StPaul) bob.basques at ci.stpaul.mn.us
Thu Jul 13 08:24:04 PDT 2017


Working on this, but not quite there yet . . .

My initial request looks like:

http://gis.ci.stpaul.mn.us/datasets/PUBLIC/LAND_OWNERSHIP/PARCELS/rc_parcels_assessment.map?
    mode=itemquery&
    qlayer=Parcels-Map-Query&
    qitem=parcelid&qstring=162823340026&
    WIDTH=1069&HEIGHT=917

I get a “no matching records” found . . . and with DEBUG 5 on the query layer . . .

    CONNECTIONTYPE PostGIS
        CONNECTION “host=localhost dbname=postgres user=mapserv password=****”

        DATA "wkb_geometry from (
            select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '%qstring%') as subquery using unique objectid srid=200068"

        VALIDATION
                'pin' '^[0-9]{12}$'
            'qstring' '^[0-9]{12}$'
            END


[Thu Jul 13 09:30:00 2017].645602 msPostGISGetPaging called.
[Thu Jul 13 09:30:00 2017].645665 msPostGISLayerIsOpen called.
[Thu Jul 13 09:30:00 2017].645672 msPostGISLayerFreeItemInfo called.
[Thu Jul 13 09:30:00 2017].645675 msPostGISLayerClose called: wkb_geometry from (
            select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery using unique objectid srid=200068
[Thu Jul 13 09:30:00 2017].645680 msPostGISLayerOpen called: wkb_geometry from (
            select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery using unique objectid srid=200068
[Thu Jul 13 09:30:00 2017].645686 msPostGISLayerOpen: No connection in pool, creating a fresh one.
[Thu Jul 13 09:30:00 2017].654626 msConnPoolRegister(Parcels-Map-Query,host=localhost dbname=postgres user=mapserv password=****,0x191b510)
[Thu Jul 13 09:30:00 2017].659333 msPostGISLayerOpen: Got PostGIS version 20200.
[Thu Jul 13 09:30:00 2017].659343 msPostGISLayerOpen: Forcing 2D geometries: yes.
[Thu Jul 13 09:30:00 2017].659347 msPostGISEnablePaging called.
[Thu Jul 13 09:30:00 2017].659349 msPostGISLayerIsOpen called.
[Thu Jul 13 09:30:00 2017].659354 msPostGISLayerFreeItemInfo called.
[Thu Jul 13 09:30:00 2017].659359 msPostGISLayerFreeItemInfo called.
[Thu Jul 13 09:30:00 2017].659364 msPostGISLayerGetItems called.
[Thu Jul 13 09:30:00 2017].659368 msPostGISParseData called.
[Thu Jul 13 09:30:00 2017].659378 msPostGISParseData: unique_column=objectid, srid=, geom_column_name=wkb_geometry, table_name=(
            select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery
[Thu Jul 13 09:30:00 2017].659384 msPostGISLayerGetItems executing SQL: select * from (
            select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery where false limit 0
[Thu Jul 13 09:30:00 2017].666373 msPostGISLayerInitItemInfo called.
[Thu Jul 13 09:30:00 2017].666385 msPostGISLayerInitItemInfo called.
[Thu Jul 13 09:30:00 2017].666397 msPostGISLayerIsOpen called.
[Thu Jul 13 09:30:00 2017].666403 msPostGISLayerWhichShapes called.
[Thu Jul 13 09:30:00 2017].666406 msPostGISParseData called.
[Thu Jul 13 09:30:00 2017].666413 msPostGISParseData: unique_column=objectid, srid=, geom_column_name=wkb_geometry, table_name=(
            select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery
[Thu Jul 13 09:30:00 2017].666417 msPostGISBuildSQL called.
[Thu Jul 13 09:30:00 2017].666419 msPostGISBuildSQLItems called.
[Thu Jul 13 09:30:00 2017].666422 msPostGISBuildSQLItems: 2 items requested.
[Thu Jul 13 09:30:00 2017].666426 msPostGISBuildSQLFrom called.
[Thu Jul 13 09:30:00 2017].666429 msPostGISBuildSQLWhere called.
[Thu Jul 13 09:30:00 2017].666432 msPostGISBuildSQLSRID called.
[Thu Jul 13 09:30:00 2017].666435 msPostGISBuildSQLSRID: Building find_srid line.
[Thu Jul 13 09:30:00 2017].666438 msPostGISBuildSQLBox called.
[Thu Jul 13 09:30:00 2017].666459 msPostGISLayerWhichShapes query: select "objectid","parcelid",encode(ST_AsBinary(ST_Force2D("wkb_geometry"),'NDR'),'hex') as geom,"objectid" from (
            select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery where wkb_geometry && ST_GeomFromText('POLYGON((573387 162092,573387 162555,574211 162555,574211 162092,573387 162092))',find_srid('','cache.rc_parcel_poly','wkb_geometry')) and ("parcelid"::text = '162823340026')
[Thu Jul 13 09:30:01 2017].114391 msPostGISLayerWhichShapes query status: PGRES_TUPLES_OK (2)
[Thu Jul 13 09:30:01 2017].114407 msPostGISLayerWhichShapes got 0 records in result.
[Thu Jul 13 09:30:01 2017].114412 msPostGISLayerNextShape called.
[Thu Jul 13 09:30:01 2017].114416 msPostGISLayerFreeItemInfo called.
[Thu Jul 13 09:30:01 2017].114419 msPostGISLayerClose called: wkb_geometry from (
            select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery using unique objectid srid=200068
[Thu Jul 13 09:30:01 2017].114443 msConnPoolRelease(Parcels-Map-Query,host=localhost dbname=postgres user=mapserv password=****,0x191b510)
[Thu Jul 13 09:30:01 2017].114447 msConnPoolClose(host=localhost dbname=postgres user=mapserv password=****,0x191b510)
[Thu Jul 13 09:30:01 2017].114546 msQueryByFilter(): Search returned no results. No matching record(s) found.
[Thu Jul 13 09:30:01 2017].114657 freeLayer(): freeing layer at 0x18e8a40.
[Thu Jul 13 09:30:01 2017].114661 msPostGISLayerIsOpen called.

The subquery works fine from sql and returns a single record.  One thing I noticed, is that the POLYGON BBOX is way off to the west a few thousand feet.  There is no default image size in the Mapfile either so I don’t know where that number is coming from other than shpext . . . are there other parameters that need to be added to the shpext call?

the TEMPLATE link looks like:

    TEMPLATE 'http://gis.ci.stpaul.mn.us/datasets/PUBLIC/LAND_OWNERSHIP/PARCELS/rc_parcels_assessment.map?pin=162823340026&FORMAT=image%2Fpng&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&LAYERS=all&_OLSALT=0.7873164216111053&SRS=EPSG%3A200068&BBOX=[shpext format="$minx,$miny,$maxx,$maxy"]&WIDTH=1069&HEIGHT=917'

This will (should) return an image, should it be some sort of text return instead?  I’m trying to keep it WMS too . . . is this still doable??

bobb
On Jul 12, 2017, at 10:41 AM, Lime, Steve D (MNIT) <Steve.Lime at state.mn.us<mailto:Steve.Lime at state.mn.us>> wrote:

The shpext tag can re-project, format and buffer a shapes extent if that helps.

From: Basques, Bob (CI-StPaul) [mailto:bob.basques at ci.stpaul.mn.us]
Sent: Wednesday, July 12, 2017 8:37 AM
To: Lime, Steve D (MNIT) <steve.lime at state.mn.us<mailto:steve.lime at state.mn.us>>
Cc: Stephen Woodbridge <woodbri at swoodbridge.com<mailto:woodbri at swoodbridge.com>>; mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
Subject: Re: [mapserver-users] Fwd: Zoom to something and display in one shot from MapServer CGI.

Steve (L),

That’s really close to what I was looking for.  I vaguely remembered something going on enhancement wise, related to URL requests inside of a MapServer request.

I’ll try this out and get back here with the results.

bobb




"I like nonsense; it wakes up the brain cells."
- Dr. Seuss






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20170713/99c6dc24/attachment.htm>


More information about the MapServer-users mailing list